summaryrefslogtreecommitdiff
path: root/ext/opcache/tests/jit/fetch_obj_001.phpt
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-09-26 12:22:48 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-09-27 10:11:47 +0200
commita66c60cce3cd8878284fb39388080cfb6bac8ff5 (patch)
tree417941074c593391c0b61613082b69334e757cf4 /ext/opcache/tests/jit/fetch_obj_001.phpt
parente8d2097bdc467e4ad814e23b406f70c3dc568ff4 (diff)
downloadphp-git-a66c60cce3cd8878284fb39388080cfb6bac8ff5.tar.gz
Throw Error when writing property of non-object
This removes object auto-vivification support. This also means that we can remove the corresponding special handling for typed properites: We no longer need to check that a property is convertible to stdClass if such a conversion might take place indirectly due to a nested property write. Additionally OBJ_W style operations now no longer modify the object operand, and as such we no longer need to treat op1 as a def in SSA form. The next step would be to actually compile the whole LHS of OBJ_W operations in R rather than W mode, but that causes issues with SimpleXML, whose object handlers depend on the current compilation structure. Part of https://wiki.php.net/rfc/engine_warnings.
Diffstat (limited to 'ext/opcache/tests/jit/fetch_obj_001.phpt')
-rw-r--r--ext/opcache/tests/jit/fetch_obj_001.phpt42
1 files changed, 22 insertions, 20 deletions
diff --git a/ext/opcache/tests/jit/fetch_obj_001.phpt b/ext/opcache/tests/jit/fetch_obj_001.phpt
index 3c0370d720..2fa44d69ca 100644
--- a/ext/opcache/tests/jit/fetch_obj_001.phpt
+++ b/ext/opcache/tests/jit/fetch_obj_001.phpt
@@ -21,6 +21,7 @@ function foo3(&$a, $var) {
$a = $var;
}
+$obj = new stdClass;
foo($obj->a);
var_dump($obj);
foo2($obj->b);
@@ -34,6 +35,7 @@ $a = fopen(__FILE__, "r");
var_dump($obj);
function bar() {
+ $obj = new stdClass;
foo($obj->a);
var_dump($obj);
foo2($obj->b);
@@ -47,22 +49,33 @@ function bar() {
var_dump($obj);
$d = array();
- foo($d->{"ab" ."c"});
+ try {
+ foo($d->{"ab" ."c"});
+ } catch (Error $err) {
+ echo $err->getMessage(), "\n";
+ }
var_dump($d);
$e = NULL;
- foo($e->{"ab" ."c"});
+ try {
+ foo($e->{"ab" ."c"});
+ } catch (Error $err) {
+ echo $err->getMessage(), "\n";
+ }
var_dump($e);
$f = "";
- foo($f->{"ab" ."c"});
+ try {
+ foo($f->{"ab" ."c"});
+ } catch (Error $err) {
+ echo $err->getMessage(), "\n";
+ }
var_dump($f);
}
bar();
?>
--EXPECTF--
-Warning: Creating default object from empty value in %s on line 14
object(stdClass)#%d (1) {
["a"]=>
int(2)
@@ -89,8 +102,6 @@ object(stdClass)#%d (2) {
array(0) {
}
}
-
-Warning: Creating default object from empty value in %s on line 27
object(stdClass)#%d (1) {
["a"]=>
int(2)
@@ -117,19 +128,10 @@ object(stdClass)#%d (2) {
array(0) {
}
}
-
-Warning: Attempt to modify property 'abc' of non-object in %sfetch_obj_001.php on line 40
+Attempt to modify property 'abc' of non-object
array(0) {
}
-
-Warning: Creating default object from empty value in %s on line 44
-object(stdClass)#%d (1) {
- ["abc"]=>
- int(2)
-}
-
-Warning: Creating default object from empty value in %s on line 48
-object(stdClass)#%d (1) {
- ["abc"]=>
- int(2)
-}
+Attempt to modify property 'abc' of non-object
+NULL
+Attempt to modify property 'abc' of non-object
+string(0) ""