php-src/Zend/tests/objects_020.phpt
David Walker e63febb1c7 Fixed bug #75921
Ensure that the "creating default object from empty value" warning is
always thrown. Previously some cases were missing the warning, in
particular those going through FETCH_OBJ_W rather than a dedicated
opcode (like ASSIGN_OBJ).

One slightly unfortunate side-effect of this change is that something
like $a->b->c = 'd' will now generate two warnings rather than one
when $a is null (one for property b, one for property c).
2019-02-14 12:50:25 +01:00

27 lines
394 B
PHP

--TEST--
Accessing members of standard object through of variable variable
--FILE--
<?php
error_reporting(E_ALL);
$test = 'stdclass';
$$test->a =& $$test;
$$test->a->b[] = 2;
var_dump($$test);
?>
--EXPECTF--
Warning: Creating default object from empty value in %sobjects_020.php on line 7
object(stdClass)#%d (2) {
["a"]=>
*RECURSION*
["b"]=>
array(1) {
[0]=>
int(2)
}
}