mirror of
https://github.com/php/php-src.git
synced 2024-12-02 22:34:55 +08:00
e63febb1c7
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).
27 lines
394 B
PHP
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)
|
|
}
|
|
}
|