Browse Source

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.
pull/4748/head
Nikita Popov 6 years ago
parent
commit
a66c60cce3
  1. 5
      UPGRADING
  2. 9
      Zend/tests/026.phpt
  3. 18
      Zend/tests/033.phpt
  4. 20
      Zend/tests/assign_dim_obj_null_return.phpt
  5. 18
      Zend/tests/assign_ref_error_var_handling.phpt
  6. 8
      Zend/tests/bug36303.phpt
  7. 31
      Zend/tests/bug41075.phpt
  8. 56
      Zend/tests/bug44660.phpt
  9. 21
      Zend/tests/bug48004.phpt
  10. 110
      Zend/tests/bug52041.phpt
  11. 10
      Zend/tests/bug52237.phpt
  12. 13
      Zend/tests/bug52614.phpt
  13. 17
      Zend/tests/bug54262.phpt
  14. 16
      Zend/tests/bug54265.phpt
  15. 17
      Zend/tests/bug62005.phpt
  16. 9
      Zend/tests/bug71539_5.phpt
  17. 15
      Zend/tests/bug72911.phpt
  18. 27
      Zend/tests/bug74084.phpt
  19. 10
      Zend/tests/bug75241.phpt
  20. 8
      Zend/tests/bug75573.phpt
  21. 93
      Zend/tests/bug75921.phpt
  22. 15
      Zend/tests/bug78182.phpt
  23. 45
      Zend/tests/bug78531.phpt
  24. 26
      Zend/tests/objects_020.phpt
  25. 203
      Zend/tests/type_declarations/typed_properties_091.phpt
  26. 4
      Zend/zend_compile.c
  27. 1
      Zend/zend_compile.h
  28. 141
      Zend/zend_execute.c
  29. 30
      Zend/zend_vm_def.h
  30. 450
      Zend/zend_vm_execute.h
  31. 4
      Zend/zend_vm_gen.php
  32. 2
      Zend/zend_vm_opcodes.h
  33. 13
      ext/dom/tests/bug47430.phpt
  34. 4
      ext/opcache/Optimizer/zend_dfg.c
  35. 4
      ext/opcache/Optimizer/zend_dump.c
  36. 59
      ext/opcache/Optimizer/zend_inference.c
  37. 4
      ext/opcache/Optimizer/zend_ssa.c
  38. 12
      ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt
  39. 42
      ext/opcache/tests/jit/fetch_obj_001.phpt
  40. 5
      ext/standard/tests/general_functions/var_export_error2.phpt
  41. 156
      tests/classes/implicit_instantiation_001.phpt
  42. 3
      tests/lang/bug24499.phpt
  43. 8
      tests/lang/bug7515.phpt
  44. 28
      tests/lang/engine_assignExecutionOrder_008.phpt
  45. 26
      tests/lang/foreachLoop.016.phpt
  46. 180
      tests/lang/passByReference_006.phpt

5
UPGRADING

@ -86,6 +86,11 @@ PHP 8.0 UPGRADE NOTES
function test(?int $arg = CONST_RESOLVING_TO_NULL) {}
// Or
function test(int $arg = null) {}
. Attempting to write to a property of a non-object will now result in an
Error exception. Previously this resulted in a warning and either converted
the value into an object (if it was null, false or an empty string) or
ignored the write altogether (in all other cases).
RFC: Part of https://wiki.php.net/rfc/engine_warnings
- COM:
. Removed the ability to import case-insensitive constants from type

9
Zend/tests/026.phpt

@ -13,13 +13,16 @@ $test = new foo;
$test->a()->a;
print "ok\n";
$test->a()->a = 1;
try {
$test->a()->a = 1;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
print "ok\n";
?>
--EXPECTF--
Notice: Trying to get property 'a' of non-object in %s on line %d
ok
Warning: Creating default object from empty value in %s on line %d
Attempt to assign property 'a' of non-object
ok

18
Zend/tests/033.phpt

@ -9,11 +9,19 @@ echo $arr[1][2][3][4][5];
$arr[1][2][3][4][5]->foo;
$arr[1][2][3][4][5]->foo = 1;
try {
$arr[1][2][3][4][5]->foo = 1;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
$arr[][] = 2;
$arr[][]->bar = 2;
try {
$arr[][]->bar = 2;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
@ -54,7 +62,5 @@ Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to access array offset on value of type null in %s on line %d
Notice: Trying to get property 'foo' of non-object in %s on line %d
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
Attempt to assign property 'foo' of non-object
Attempt to assign property 'bar' of non-object

20
Zend/tests/assign_dim_obj_null_return.phpt

@ -17,8 +17,16 @@ function test() {
var_dump($array[new stdClass] += 123);
var_dump($true[123] += 456);
var_dump($true->foo = 123);
var_dump($true->foo += 123);
try {
var_dump($true->foo = 123);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
var_dump($true->foo += 123);
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
}
test();
@ -48,9 +56,5 @@ NULL
Warning: Cannot use a scalar value as an array in %s on line %d
NULL
Warning: Attempt to assign property 'foo' of non-object in %s on line %d
NULL
Warning: Attempt to assign property 'foo' of non-object in %s on line %d
NULL
Attempt to assign property 'foo' of non-object
Attempt to assign property 'foo' of non-object

18
Zend/tests/assign_ref_error_var_handling.phpt

@ -7,19 +7,19 @@ function val() {
return 42;
}
$str = "foo";
$var = 24;
var_dump($str->foo =& $var);
var_dump($str);
var_dump($str->foo =& val());
var_dump($str);
$arr = [PHP_INT_MAX => "foo"];
var_dump($arr[] =& $var);
var_dump(count($arr));
var_dump($arr[] =& val());
var_dump(count($arr));
?>
--EXPECTF--
Warning: Attempt to modify property 'foo' of non-object in %s on line %d
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
NULL
string(3) "foo"
int(1)
Warning: Attempt to modify property 'foo' of non-object in %s on line %d
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
NULL
string(3) "foo"
int(1)

8
Zend/tests/bug36303.phpt

@ -2,13 +2,13 @@
Bug #36303 (foreach on error_zval produces segfault)
--FILE--
<?php
$x="test";
foreach($x->a->b as &$v) {
$x=[PHP_INT_MAX=>"test"];
foreach ($x[] as &$v) {
}
echo "ok\n";
?>
--EXPECTF--
Warning: Attempt to modify property 'a' of non-object in %sbug36303.php on line 3
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
Warning: Invalid argument supplied for foreach() in %sbug36303.php on line 3
Warning: Invalid argument supplied for foreach() in %s on line %d
ok

31
Zend/tests/bug41075.phpt

@ -1,31 +0,0 @@
--TEST--
Bug #41075 (memleak when creating default object caused exception)
--FILE--
<?php
function err($errno, $errstr, $errfile, $errline)
{
throw new Exception($errstr);
}
set_error_handler("err");
class test {
function foo() {
$var = $this->blah->prop = "string";
var_dump($this->blah);
}
}
$t = new test;
try {
$t->foo();
} catch (Exception $e) {
var_dump($e->getMessage());
}
echo "Done\n";
?>
--EXPECT--
string(40) "Creating default object from empty value"
Done

56
Zend/tests/bug44660.phpt

@ -8,42 +8,62 @@ $a = true;
echo "--> read access: ";
echo $a->p;
echo "\n--> direct assignment: ";
$a->p = $s;
echo "\n--> direct assignment:\n";
try {
$a->p = $s;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
echo "\n--> increment: ";
$a->p++;
echo "\n--> increment:\n";
try {
$a->p++;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
echo "\n--> reference assignment:";
$a->p =& $s;
echo "\n--> reference assignment:\n";
try {
$a->p =& $s;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
echo "\n--> reference assignment:";
$s =& $a->p;
echo "\n--> reference assignment:\n";
try {
$s =& $a->p;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
echo "\n--> indexed assignment:";
$a->p[0] = $s;
echo "\n--> indexed assignment:\n";
try {
$a->p[0] = $s;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
echo "\n--> Confirm assignments have had no impact:\n";
var_dump($a);
?>
--EXPECTF--
--> read access:
Notice: Trying to get property 'p' of non-object in %sbug44660.php on line 6
Notice: Trying to get property 'p' of non-object in %s on line %d
--> direct assignment:
Warning: Attempt to assign property 'p' of non-object in %sbug44660.php on line 9
--> direct assignment:
Attempt to assign property 'p' of non-object
--> increment:
Warning: Attempt to increment/decrement property 'p' of non-object in %sbug44660.php on line 12
--> increment:
Attempt to increment/decrement property 'p' of non-object
--> reference assignment:
Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 15
Attempt to modify property 'p' of non-object
--> reference assignment:
Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 18
Attempt to modify property 'p' of non-object
--> indexed assignment:
Warning: Attempt to modify property 'p' of non-object in %sbug44660.php on line 21
Attempt to modify property 'p' of non-object
--> Confirm assignments have had no impact:
bool(true)

21
Zend/tests/bug48004.phpt

@ -1,21 +0,0 @@
--TEST--
Bug #48004 (Error handler prevents creation of default object)
--FILE--
<?php
function error_handler($errno, $errstr, $errfile, $errline) {
return true;
}
function test() {
$data->id = 1;
print_r($data);
}
set_error_handler("error_handler");
test();
?>
--EXPECT--
stdClass Object
(
[id] => 1
)

110
Zend/tests/bug52041.phpt

@ -6,12 +6,36 @@ function foo() {
return $x;
}
foo()->a = 1;
foo()->a->b = 2;
foo()->a++;
foo()->a->b++;
foo()->a += 2;
foo()->a->b += 2;
try {
foo()->a = 1;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
foo()->a->b = 2;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
foo()->a++;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
foo()->a->b++;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
foo()->a += 2;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
foo()->a->b += 2;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
foo()[0] = 1;
foo()[0][0] = 2;
@ -23,71 +47,47 @@ foo()[0][0] += 2;
var_dump(foo());
?>
--EXPECTF--
Notice: Undefined variable: x in %sbug52041.php on line 3
Warning: Creating default object from empty value in %sbug52041.php on line 6
Notice: Undefined variable: x in %sbug52041.php on line 3
Warning: Creating default object from empty value in %sbug52041.php on line 7
Warning: Creating default object from empty value in %sbug52041.php on line 7
Notice: Undefined variable: x in %sbug52041.php on line 3
Warning: Creating default object from empty value in %sbug52041.php on line 8
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 8
Notice: Undefined variable: x in %sbug52041.php on line 3
Warning: Creating default object from empty value in %sbug52041.php on line 9
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 9
Warning: Creating default object from empty value in %sbug52041.php on line 9
Notice: Undefined property: stdClass::$b in %sbug52041.php on line 9
Notice: Undefined variable: x in %sbug52041.php on line 3
Warning: Creating default object from empty value in %sbug52041.php on line 10
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 10
Notice: Undefined variable: x in %s on line %d
Attempt to assign property 'a' of non-object
Notice: Undefined variable: x in %sbug52041.php on line 3
Notice: Undefined variable: x in %s on line %d
Attempt to modify property 'a' of non-object
Warning: Creating default object from empty value in %sbug52041.php on line 11
Notice: Undefined variable: x in %s on line %d
Attempt to increment/decrement property 'a' of non-object
Notice: Undefined property: stdClass::$a in %sbug52041.php on line 11
Notice: Undefined variable: x in %s on line %d
Attempt to modify property 'a' of non-object
Warning: Creating default object from empty value in %sbug52041.php on line 11
Notice: Undefined variable: x in %s on line %d
Attempt to assign property 'a' of non-object
Notice: Undefined property: stdClass::$b in %sbug52041.php on line 11
Notice: Undefined variable: x in %s on line %d
Attempt to modify property 'a' of non-object
Notice: Undefined variable: x in %sbug52041.php on line 3
Notice: Undefined variable: x in %s on line %d
Notice: Undefined variable: x in %sbug52041.php on line 3
Notice: Undefined variable: x in %s on line %d
Notice: Undefined variable: x in %sbug52041.php on line 3
Notice: Undefined variable: x in %s on line %d
Notice: Undefined offset: 0 in %sbug52041.php on line 15
Notice: Undefined offset: 0 in %s on line %d
Notice: Undefined variable: x in %sbug52041.php on line 3
Notice: Undefined variable: x in %s on line %d
Notice: Undefined offset: 0 in %sbug52041.php on line 16
Notice: Undefined offset: 0 in %s on line %d
Notice: Undefined offset: 0 in %sbug52041.php on line 16
Notice: Undefined offset: 0 in %s on line %d
Notice: Undefined variable: x in %sbug52041.php on line 3
Notice: Undefined variable: x in %s on line %d
Notice: Undefined offset: 0 in %sbug52041.php on line 17
Notice: Undefined offset: 0 in %s on line %d
Notice: Undefined variable: x in %sbug52041.php on line 3
Notice: Undefined variable: x in %s on line %d
Notice: Undefined offset: 0 in %sbug52041.php on line 18
Notice: Undefined offset: 0 in %s on line %d
Notice: Undefined offset: 0 in %sbug52041.php on line 18
Notice: Undefined offset: 0 in %s on line %d
Notice: Undefined variable: x in %sbug52041.php on line 3
Notice: Undefined variable: x in %s on line %d
NULL

10
Zend/tests/bug52237.phpt

@ -2,10 +2,10 @@
Bug #52237 (Crash when passing the reference of the property of a non-object)
--FILE--
<?php
$data = 'test';
preg_match('//', '', $data->info);
var_dump($data);
$data = [PHP_INT_MAX => 'test'];
preg_match('//', '', $data[]);
var_dump(count($data));
?>
--EXPECTF--
Warning: Attempt to modify property 'info' of non-object in %sbug52237.php on line 3
string(4) "test"
Warning: Cannot add element to the array as the next element is already occupied in %s on line %d
int(1)

13
Zend/tests/bug52614.phpt

@ -52,7 +52,11 @@ var_dump($foo->a2);
$foo->f3()[0] = 1;
var_dump($foo->a3);
$foo->f4()->a = 1;
try {
$foo->f4()->a = 1;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($foo->o1);
$foo->f5()->a = 1;
@ -65,16 +69,15 @@ $foo->f1()[0]++;
var_dump($foo->a1[0]);
$foo->f6()[0]++;
var_dump($foo->a1[0]);
--EXPECTF--
--EXPECT--
NULL
array(0) {
}
array(0) {
}
Warning: Creating default object from empty value in %sbug52614.php on line 52
Attempt to assign property 'a' of non-object
NULL
object(stdClass)#%d (1) {
object(stdClass)#3 (1) {
["a"]=>
int(1)
}

17
Zend/tests/bug54262.phpt

@ -1,17 +0,0 @@
--TEST--
Bug #54262 (Crash when assigning value to a dimension in a non-array)
--FILE--
<?php
$a = '0';
var_dump(isset($a['b']));
$simpleString = preg_match('//', '', $a->a);
$simpleString["wrong"] = "f";
echo "ok\n";
?>
--EXPECTF--
bool(false)
Warning: Attempt to modify property 'a' of non-object in %sbug54262.php on line 4
Warning: Cannot use a scalar value as an array in %sbug54262.php on line 5
ok

16
Zend/tests/bug54265.phpt

@ -1,16 +0,0 @@
--TEST--
Bug #54265 (crash when variable gets reassigned in error handler)
--FILE--
<?php
function my_errorhandler($errno,$errormsg) {
global $my_var;
$my_var = 0;
echo "EROOR: $errormsg\n";
}
set_error_handler("my_errorhandler");
$my_var = str_repeat("A",$my_var[0]->errormsg = "xyz");
echo "ok\n";
?>
--EXPECT--
EROOR: Creating default object from empty value
ok

17
Zend/tests/bug62005.phpt

@ -1,17 +0,0 @@
--TEST--
Bug #62005 (unexpected behavior when incrementally assigning to a member of a null object)
--FILE--
<?php
function add_points($player, $points) {
$player->energy += $points;
print_r($player);
}
add_points(NULL, 2);
--EXPECTF--
Warning: Creating default object from empty value in %sbug62005.php on line %d
Notice: Undefined property: stdClass::$energy in %sbug62005.php on line 3
stdClass Object
(
[energy] => 2
)

9
Zend/tests/bug71539_5.phpt

@ -3,18 +3,17 @@ Bug #71539.5 (Memory error on $arr[$a] =& $arr[$b] if RHS rehashes)
--FILE--
<?php
$array = [];
$array['']->prop =& $array[0];
$array[''][0] =& $array[0];
$array[0] = 42;
var_dump($array);
?>
--EXPECTF--
Warning: Creating default object from empty value in %sbug71539_5.php on line 3
--EXPECT--
array(2) {
[0]=>
&int(42)
[""]=>
object(stdClass)#1 (1) {
["prop"]=>
array(1) {
[0]=>
&int(42)
}
}

15
Zend/tests/bug72911.phpt

@ -1,15 +0,0 @@
--TEST--
Bug #72911 (Memleak in zend_binary_assign_op_obj_helper)
--FILE--
<?php
$a = 0;
$b = $a->b->i -= 0;
var_dump($b);
?>
--EXPECTF--
Warning: Attempt to modify property 'b' of non-object in %sbug72911.php on line %d
NULL

27
Zend/tests/bug74084.phpt

@ -4,16 +4,31 @@ Bug #74084 (Out of bound read - zend_mm_alloc_small)
error_reporting=0
--FILE--
<?php
$$A += $$B->a = &$$C;
$$A += $$B['a'] = &$$C;
unset($$A);
$$A -= $$B->a = &$$C;
try {
$$A -= $$B['a'] = &$$C;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
unset($$A);
$$A *= $$B->a = &$$C;
try {
$$A *= $$B['a'] = &$$C;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
unset($$A);
$$A /= $$B->a = &$$C;
try {
$$A /= $$B['a'] = &$$C;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
unset($$A);
$$A **= $$B->a = &$$C;
$$A **= $$B['a'] = &$$C;
var_dump($$A);
?>
--EXPECT--
int(1)
Unsupported operand types
Unsupported operand types
Unsupported operand types
int(0)

10
Zend/tests/bug75241.phpt

@ -2,12 +2,12 @@
Bug #75241 (Null pointer dereference in zend_mm_alloc_small())
--FILE--
<?php
function eh(){}
set_error_handler('eh');
$d->d = &$d + $d->d/=0;
var_dump($d);
?>
--EXPECT--
float(INF)
--EXPECTF--
Fatal error: Uncaught Error: Attempt to modify property 'd' of non-object in %s:%d
Stack trace:
#0 {main}
thrown in %s on line %d

8
Zend/tests/bug75573.phpt

@ -6,6 +6,10 @@ Bug #75573 (Segmentation fault in 7.1.12 and 7.0.26)
class A
{
var $_stdObject;
function __construct()
{
$this->_stdObject = new stdClass;
}
function &__get($property)
{
if (isset($this->_stdObject->{$property})) {
@ -44,9 +48,7 @@ var_dump($b->name);
var_dump($b->settings);
?>
--EXPECTF--
Warning: Creating default object from empty value in %sbug75573.php on line %d
Notice: Only variable references should be returned by reference in %sbug75573.php on line %d
Notice: Only variable references should be returned by reference in %s on line %d
string(3) "abc"
array(2) {
["foo"]=>

93
Zend/tests/bug75921.phpt

@ -3,78 +3,65 @@ Bug #75921: Inconsistent error when creating stdObject from empty variable
--FILE--
<?php
$null->a = 42;
try {
$null->a = 42;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($null);
unset($null);
$null->a['hello'] = 42;
try {
$null->a['hello'] = 42;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($null);
unset($null);
$null->a->b = 42;
try {
$null->a->b = 42;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($null);
unset($null);
$null->a['hello']->b = 42;
try {
$null->a['hello']->b = 42;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($null);
unset($null);
$null->a->b['hello'] = 42;
try {
$null->a->b['hello'] = 42;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($null);
unset($null);
?>
--EXPECTF--
Warning: Creating default object from empty value in %sbug75921.php on line 3
object(stdClass)#1 (1) {
["a"]=>
int(42)
}
Attempt to assign property 'a' of non-object
Warning: Creating default object from empty value in %sbug75921.php on line 7
object(stdClass)#1 (1) {
["a"]=>
array(1) {
["hello"]=>
int(42)
}
}
Warning: Creating default object from empty value in %sbug75921.php on line 11
Warning: Creating default object from empty value in %sbug75921.php on line 11
object(stdClass)#1 (1) {
["a"]=>
object(stdClass)#2 (1) {
["b"]=>
int(42)
}
}
Notice: Undefined variable: null in %s on line %d
NULL
Attempt to modify property 'a' of non-object
Warning: Creating default object from empty value in %sbug75921.php on line 15
Notice: Undefined variable: null in %s on line %d
NULL
Attempt to modify property 'a' of non-object
Warning: Creating default object from empty value in %sbug75921.php on line 15
object(stdClass)#1 (1) {
["a"]=>
array(1) {
["hello"]=>
object(stdClass)#2 (1) {
["b"]=>
int(42)
}
}
}
Notice: Undefined variable: null in %s on line %d
NULL
Attempt to modify property 'a' of non-object
Warning: Creating default object from empty value in %sbug75921.php on line 19
Notice: Undefined variable: null in %s on line %d
NULL
Attempt to modify property 'a' of non-object
Warning: Creating default object from empty value in %sbug75921.php on line 19
object(stdClass)#1 (1) {
["a"]=>
object(stdClass)#2 (1) {
["b"]=>
array(1) {
["hello"]=>
int(42)
}
}
}
Notice: Undefined variable: null in %s on line %d
NULL

15
Zend/tests/bug78182.phpt

@ -4,12 +4,13 @@ Bug #78182: Segmentation fault during by-reference property assignment
<?php
$varName = 'var';
$propName = 'prop';
$$varName->$propName =& $$varName;
try {
$$varName->$propName =& $$varName;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($var);
?>
--EXPECTF--
Warning: Creating default object from empty value in %s on line %d
object(stdClass)#1 (1) {
["prop"]=>
*RECURSION*
}
--EXPECT--
Attempt to modify property 'prop' of non-object
NULL

45
Zend/tests/bug78531.phpt

@ -2,17 +2,36 @@
Bug #78531 (Crash when using undefined variable as object)
--FILE--
<?php
@$u1->a += 5;
var_dump($u1->a);
@$x = ++$u2->a;
var_dump($u2->a);
@$x = $u3->a++;
var_dump($u3->a);
@$u4->a->a += 5;
var_dump($u4->a->a);
try {
$u1->a += 5;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$x = ++$u2->a;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$x = $u3->a++;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
try {
$u4->a->a += 5;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
int(5)
int(1)
int(1)
int(5)
--EXPECTF--
Notice: Undefined variable: u1 in %s on line %d
Attempt to assign property 'a' of non-object
Notice: Undefined variable: u2 in %s on line %d
Attempt to increment/decrement property 'a' of non-object
Notice: Undefined variable: u3 in %s on line %d
Attempt to increment/decrement property 'a' of non-object
Notice: Undefined variable: u4 in %s on line %d
Attempt to modify property 'a' of non-object

26
Zend/tests/objects_020.phpt

@ -1,26 +0,0 @@
--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)
}
}

203
Zend/tests/type_declarations/typed_properties_091.phpt

@ -1,203 +0,0 @@
--TEST--
Automatic promotion of falsy to object
--FILE--
<?php
class Test {
public ?Test $prop;
public ?stdClass $stdProp;
public ?object $objectProp;
public static ?Test $staticProp = null;
public static ?stdClass $staticStdProp = null;
public static ?object $staticObjectProp = null;
}
// Object properties
$test = new Test;
try {
$test->prop->wat = 123;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
$test->stdProp->wat = 123;
$test->objectProp->wat = 123;
var_dump($test);
// Object properties via reference
$test = new Test;
$prop =& $test->prop;
$stdProp =& $test->stdProp;
$objectProp =& $test->objectProp;
try {
$prop->wat = 123;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
$stdProp->wat = 123;
$objectProp->wat = 123;
var_dump($test);
// Object properties via reference rw
$test = new Test;
$prop =& $test->prop;
$stdProp =& $test->stdProp;
$objectProp =& $test->objectProp;
try {
$prop->wat->wat = 123;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
$stdProp->wat->wat = 123;
$objectProp->wat->wat = 123;
var_dump($test);
// Static properties
try {
Test::$staticProp->wat = 123;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
Test::$staticStdProp->wat = 123;
Test::$staticObjectProp->wat = 123;
var_dump(Test::$staticProp, Test::$staticStdProp, Test::$staticObjectProp);
// Non-string property name
$test = new Test;
$propName = new class {
public function __toString() {
return 'prop';
}
};
try {
$test->$propName->wat = 123;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
var_dump($test);
// Initially null
$test = new Test;
$test->prop = NULL;
$test->stdProp = NULL;
$test->objectProp = NULL;
try {
$test->prop->wat = 123;
} catch (TypeError $e) {
echo $e->getMessage(), "\n";
}
$test->stdProp->wat = 123;
$test->objectProp->wat = 123;
var_dump($test);
?>
--EXPECTF--
Cannot auto-initialize an stdClass inside property Test::$prop of type ?Test
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
object(Test)#1 (2) {
["prop"]=>
uninitialized(?Test)
["stdProp"]=>
object(stdClass)#3 (1) {
["wat"]=>
int(123)
}
["objectProp"]=>
object(stdClass)#4 (1) {
["wat"]=>
int(123)
}
}
Cannot auto-initialize an stdClass inside a reference held by property Test::$prop of type ?Test
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
object(Test)#5 (3) {
["prop"]=>
&NULL
["stdProp"]=>
&object(stdClass)#2 (1) {
["wat"]=>
int(123)
}
["objectProp"]=>
&object(stdClass)#4 (1) {
["wat"]=>
int(123)
}
}
Cannot auto-initialize an stdClass inside a reference held by property Test::$prop of type ?Test
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
object(Test)#3 (3) {
["prop"]=>
&NULL
["stdProp"]=>
&object(stdClass)#1 (1) {
["wat"]=>
object(stdClass)#2 (1) {
["wat"]=>
int(123)
}
}
["objectProp"]=>
&object(stdClass)#5 (1) {
["wat"]=>
object(stdClass)#6 (1) {
["wat"]=>
int(123)
}
}
}
Cannot auto-initialize an stdClass inside property Test::$staticProp of type ?Test
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
NULL
object(stdClass)#4 (1) {
["wat"]=>
int(123)
}
object(stdClass)#8 (1) {
["wat"]=>
int(123)
}
Cannot auto-initialize an stdClass inside property Test::$prop of type ?Test
object(Test)#9 (0) {
["prop"]=>
uninitialized(?Test)
["stdProp"]=>
uninitialized(?stdClass)
["objectProp"]=>
uninitialized(?object)
}
Cannot auto-initialize an stdClass inside property Test::$prop of type ?Test
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
object(Test)#7 (3) {
["prop"]=>
NULL
["stdProp"]=>
object(stdClass)#10 (1) {
["wat"]=>
int(123)
}
["objectProp"]=>
object(stdClass)#11 (1) {
["wat"]=>
int(123)
}
}

4
Zend/zend_compile.c

@ -2520,10 +2520,6 @@ static zend_op *zend_delayed_compile_prop(znode *result, zend_ast *ast, uint32_t
CG(active_op_array)->fn_flags |= ZEND_ACC_USES_THIS;
} else {
opline = zend_delayed_compile_var(&obj_node, obj_ast, type, 0);
if (opline && type == BP_VAR_W && (opline->opcode == ZEND_FETCH_STATIC_PROP_W || opline->opcode == ZEND_FETCH_OBJ_W)) {
opline->extended_value |= ZEND_FETCH_OBJ_WRITE;
}
zend_separate_if_call_and_write(&obj_node, obj_ast, type);
}
zend_compile_expr(&prop_node, prop_ast);

1
Zend/zend_compile.h

@ -917,7 +917,6 @@ zend_string *zend_type_to_string(zend_type type);
/* Only one of these can ever be in use */
#define ZEND_FETCH_REF 1
#define ZEND_FETCH_DIM_WRITE 2
#define ZEND_FETCH_OBJ_WRITE 3
#define ZEND_FETCH_OBJ_FLAGS 3
#define ZEND_ISEMPTY (1<<0)

141
Zend/zend_execute.c

@ -612,70 +612,39 @@ static zend_never_inline ZEND_COLD void zend_throw_access_uninit_prop_by_ref_err
zend_get_unmangled_property_name(prop->name));
}
static zend_never_inline zend_bool zend_verify_ref_stdClass_assignable(zend_reference *ref);
static zend_never_inline zend_bool zend_verify_ref_array_assignable(zend_reference *ref);
/* this should modify object only if it's empty */
static zend_never_inline ZEND_COLD zval* ZEND_FASTCALL make_real_object(zval *object, zval *property OPLINE_DC EXECUTE_DATA_DC)
{
zend_object *obj;
zval *ref = NULL;
if (Z_ISREF_P(object)) {
ref = object;
object = Z_REFVAL_P(object);
}
if (UNEXPECTED(Z_TYPE_P(object) > IS_FALSE &&
(Z_TYPE_P(object) != IS_STRING || Z_STRLEN_P(object) != 0))) {
if (opline->op1_type != IS_VAR || EXPECTED(!Z_ISERROR_P(object))) {
zend_string *tmp_property_name;
zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name);
if (opline->opcode == ZEND_PRE_INC_OBJ
|| opline->opcode == ZEND_PRE_DEC_OBJ
|| opline->opcode == ZEND_POST_INC_OBJ
|| opline->opcode == ZEND_POST_DEC_OBJ) {
zend_error(E_WARNING, "Attempt to increment/decrement property '%s' of non-object", ZSTR_VAL(property_name));
} else if (opline->opcode == ZEND_FETCH_OBJ_W
|| opline->opcode == ZEND_FETCH_OBJ_RW
|| opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG
|| opline->opcode == ZEND_ASSIGN_OBJ_REF) {
zend_error(E_WARNING, "Attempt to modify property '%s' of non-object", ZSTR_VAL(property_name));
} else {
zend_error(E_WARNING, "Attempt to assign property '%s' of non-object", ZSTR_VAL(property_name));
}
zend_tmp_string_release(tmp_property_name);
}
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
return NULL;
}
if (ref && ZEND_REF_HAS_TYPE_SOURCES(Z_REF_P(ref))) {
if (UNEXPECTED(!zend_verify_ref_stdClass_assignable(Z_REF_P(ref)))) {
if (RETURN_VALUE_USED(opline)) {
ZVAL_UNDEF(EX_VAR(opline->result.var));
}
return NULL;
static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_throw_non_object_error(zval *object, zval *property OPLINE_DC EXECUTE_DATA_DC)
{
/* TODO: What about the ERROR case? */
if (EXPECTED(!Z_ISERROR_P(object))) {
zend_string *tmp_property_name;
zend_string *property_name = zval_get_tmp_string(property, &tmp_property_name);
if (opline->opcode == ZEND_PRE_INC_OBJ
|| opline->opcode == ZEND_PRE_DEC_OBJ
|| opline->opcode == ZEND_POST_INC_OBJ
|| opline->opcode == ZEND_POST_DEC_OBJ) {
zend_throw_error(NULL,
"Attempt to increment/decrement property '%s' of non-object",
ZSTR_VAL(property_name));
} else if (opline->opcode == ZEND_FETCH_OBJ_W
|| opline->opcode == ZEND_FETCH_OBJ_RW
|| opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG
|| opline->opcode == ZEND_ASSIGN_OBJ_REF) {
zend_throw_error(NULL,
"Attempt to modify property '%s' of non-object", ZSTR_VAL(property_name));
} else {
zend_throw_error(NULL,
"Attempt to assign property '%s' of non-object", ZSTR_VAL(property_name));
}
zend_tmp_string_release(tmp_property_name);
}
zval_ptr_dtor_nogc(object);
object_init(object);
obj = Z_OBJ_P(object);
GC_ADDREF(obj);
zend_error(E_WARNING, "Creating default object from empty value");
if (GC_REFCOUNT(obj) == 1) {
/* the enclosing container was deleted, obj is unreferenced */
OBJ_RELEASE(obj);
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
return NULL;
if (UNEXPECTED(RETURN_VALUE_USED(opline))) {
ZVAL_NULL(EX_VAR(opline->result.var));
}
GC_DELREF(obj);
return object;
}
static ZEND_COLD void zend_verify_type_error_common(
@ -2535,12 +2504,6 @@ static zend_always_inline zend_bool promotes_to_array(zval *val) {
|| (Z_ISREF_P(val) && Z_TYPE_P(Z_REFVAL_P(val)) <= IS_FALSE);
}
static zend_always_inline zend_bool promotes_to_object(zval *val) {
ZVAL_DEREF(val);
return Z_TYPE_P(val) <= IS_FALSE
|| (Z_TYPE_P(val) == IS_STRING && Z_STRLEN_P(val) == 0);
}
static zend_always_inline zend_bool check_type_array_assignable(zend_type type) {
if (!ZEND_TYPE_IS_SET(type)) {
return 1;
@ -2548,21 +2511,6 @@ static zend_always_inline zend_bool check_type_array_assignable(zend_type type)
return ZEND_TYPE_IS_MASK(type) && (ZEND_TYPE_MASK(type) & (MAY_BE_ITERABLE|MAY_BE_ARRAY));
}
static zend_always_inline zend_bool check_type_stdClass_assignable(zend_type type) {
if (!ZEND_TYPE_IS_SET(type)) {
return 1;
}
if (ZEND_TYPE_IS_CLASS(type)) {
if (ZEND_TYPE_IS_CE(type)) {
return ZEND_TYPE_CE(type) == zend_standard_class_def;
} else {
return zend_string_equals_literal_ci(ZEND_TYPE_NAME(type), "stdclass");
}
} else {
return (ZEND_TYPE_MASK(type) & MAY_BE_OBJECT) != 0;
}
}
/* Checks whether an array can be assigned to the reference. Returns conflicting property if
* assignment is not possible, NULL otherwise. */
static zend_never_inline zend_bool zend_verify_ref_array_assignable(zend_reference *ref) {
@ -2577,20 +2525,6 @@ static zend_never_inline zend_bool zend_verify_ref_array_assignable(zend_referen
return 1;
}
/* Checks whether an stdClass can be assigned to the reference. Returns conflicting property if
* assignment is not possible, NULL otherwise. */
static zend_never_inline zend_bool zend_verify_ref_stdClass_assignable(zend_reference *ref) {
zend_property_info *prop;
ZEND_ASSERT(ZEND_REF_HAS_TYPE_SOURCES(ref));
ZEND_REF_FOREACH_TYPE_SOURCES(ref, prop) {
if (!check_type_stdClass_assignable(prop->type)) {
zend_throw_auto_init_in_ref_error(prop, "stdClass");
return 0;
}
} ZEND_REF_FOREACH_TYPE_SOURCES_END();
return 1;
}
static zend_property_info *zend_object_fetch_property_type_info(
zend_object *obj, zval *slot)
{
@ -2626,21 +2560,6 @@ static zend_never_inline zend_bool zend_handle_fetch_obj_flags(
}
}
break;
case ZEND_FETCH_OBJ_WRITE:
if (promotes_to_object(ptr)) {
if (!prop_info) {
prop_info = zend_object_fetch_property_type_info(obj, ptr);
if (!prop_info) {
break;
}
}
if (!check_type_stdClass_assignable(prop_info->type)) {
zend_throw_auto_init_in_prop_error(prop_info, "stdClass");
if (result) ZVAL_ERROR(result);
return 0;
}
}
break;
case ZEND_FETCH_REF:
if (Z_TYPE_P(ptr) != IS_REFERENCE) {
if (!prop_info) {
@ -2691,11 +2610,9 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
return;
}
container = make_real_object(container, prop_ptr OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!container)) {
ZVAL_ERROR(result);
return;
}
zend_throw_non_object_error(container, prop_ptr OPLINE_CC EXECUTE_DATA_CC);
ZVAL_ERROR(result);
return;
} while (0);
}

30
Zend/zend_vm_def.h

@ -1069,10 +1069,8 @@ ZEND_VM_HANDLER(28, ZEND_ASSIGN_OBJ_OP, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, OP)
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
ZEND_VM_C_LABEL(assign_op_object):
@ -1338,10 +1336,8 @@ ZEND_VM_HANDLER(132, ZEND_PRE_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACH
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
ZEND_VM_C_LABEL(pre_incdec_object):
@ -1418,10 +1414,8 @@ ZEND_VM_HANDLER(134, ZEND_POST_INC_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CAC
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
ZEND_VM_C_LABEL(post_incdec_object):
@ -1922,7 +1916,7 @@ ZEND_VM_HANDLER(173, ZEND_FETCH_STATIC_PROP_R, ANY, CLASS_FETCH, CACHE_SLOT)
}
/* No specialization for op_types (CONST|TMPVAR|CV, UNUSED|CLASS_FETCH|CONST|VAR) */
ZEND_VM_HANDLER(174, ZEND_FETCH_STATIC_PROP_W, ANY, CLASS_FETCH, FETCH_REF|DIM_OBJ_WRITE|CACHE_SLOT)
ZEND_VM_HANDLER(174, ZEND_FETCH_STATIC_PROP_W, ANY, CLASS_FETCH, FETCH_REF|DIM_WRITE|CACHE_SLOT)
{
ZEND_VM_DISPATCH_TO_HELPER(zend_fetch_static_prop_helper, type, BP_VAR_W);
}
@ -2216,7 +2210,7 @@ ZEND_VM_C_LABEL(fetch_obj_r_finish):
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
}
ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, FETCH_REF|DIM_OBJ_WRITE|CACHE_SLOT)
ZEND_VM_HANDLER(85, ZEND_FETCH_OBJ_W, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, FETCH_REF|DIM_WRITE|CACHE_SLOT)
{
USE_OPLINE
zval *property, *container, *result;
@ -2474,11 +2468,9 @@ ZEND_VM_HANDLER(24, ZEND_ASSIGN_OBJ, VAR|UNUSED|THIS|CV, CONST|TMPVAR|CV, CACHE_
object = Z_REFVAL_P(object);
ZEND_VM_C_GOTO(assign_object);
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
ZEND_VM_C_GOTO(free_and_exit_assign_obj);
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
ZEND_VM_C_GOTO(free_and_exit_assign_obj);
}
ZEND_VM_C_LABEL(assign_object):

450
Zend/zend_vm_execute.h

@ -21874,10 +21874,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CONST_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
assign_op_object:
@ -22094,10 +22092,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CONST_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
pre_incdec_object:
@ -22168,10 +22164,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CONST_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
post_incdec_object:
@ -22404,11 +22398,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -22550,11 +22542,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -22696,11 +22686,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -22842,11 +22830,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CONST_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -24229,10 +24215,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_TMPVAR_
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
assign_op_object:
@ -24451,10 +24435,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_TMPVAR_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
pre_incdec_object:
@ -24526,10 +24508,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_TMPVAR_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
post_incdec_object:
@ -24764,11 +24744,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -24910,11 +24888,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -25056,11 +25032,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -25202,11 +25176,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_TMPVAR_OP_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -27943,10 +27915,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_VAR_CV_HAND
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
assign_op_object:
@ -28163,10 +28133,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_VAR_CV_HANDLE
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
pre_incdec_object:
@ -28237,10 +28205,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_VAR_CV_HANDL
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
post_incdec_object:
@ -28473,11 +28439,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -28619,11 +28583,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -28765,11 +28727,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -28911,11 +28871,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_VAR_CV_OP_DATA
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -30480,10 +30438,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CONS
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
assign_op_object:
@ -30581,10 +30537,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CONST_
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
pre_incdec_object:
@ -30655,10 +30609,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CONST
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
post_incdec_object:
@ -31052,11 +31004,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -31198,11 +31148,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -31344,11 +31292,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -31490,11 +31436,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CONST_O
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -32434,10 +32378,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_TMPV
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
assign_op_object:
@ -32535,10 +32477,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_TMPVAR
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
pre_incdec_object:
@ -32610,10 +32550,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_TMPVA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
post_incdec_object:
@ -33003,11 +32941,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -33149,11 +33085,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -33295,11 +33229,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -33441,11 +33373,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_TMPVAR_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -35055,10 +34985,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_UNUSED_CV_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
assign_op_object:
@ -35156,10 +35084,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_UNUSED_CV_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
pre_incdec_object:
@ -35230,10 +35156,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_UNUSED_CV_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
post_incdec_object:
@ -35622,11 +35546,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -35768,11 +35690,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -35914,11 +35834,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -36060,11 +35978,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_UNUSED_CV_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -39242,10 +39158,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CONST_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
assign_op_object:
@ -39462,10 +39376,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CONST_HAND
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
pre_incdec_object:
@ -39536,10 +39448,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CONST_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
post_incdec_object:
@ -40045,11 +39955,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -40191,11 +40099,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -40337,11 +40243,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -40483,11 +40387,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CONST_OP_DA
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -42832,10 +42734,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_TMPVAR_H
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
assign_op_object:
@ -43054,10 +42954,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_TMPVAR_HAN
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
pre_incdec_object:
@ -43129,10 +43027,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_TMPVAR_HA
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
post_incdec_object:
@ -43634,11 +43530,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -43780,11 +43674,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -43926,11 +43818,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -44072,11 +43962,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_TMPVAR_OP_D
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -47979,10 +47867,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_OP_SPEC_CV_CV_HANDL
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
assign_op_object:
@ -48199,10 +48085,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_PRE_INC_OBJ_SPEC_CV_CV_HANDLER
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
pre_incdec_object:
@ -48273,10 +48157,8 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_POST_INC_OBJ_SPEC_CV_CV_HANDLE
&& UNEXPECTED(Z_TYPE_P(object) == IS_UNDEF)) {
ZVAL_UNDEFINED_OP1();
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
break;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
break;
}
post_incdec_object:
@ -48777,11 +48659,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -48923,11 +48803,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -49069,11 +48947,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:
@ -49215,11 +49091,9 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_ASSIGN_OBJ_SPEC_CV_CV_OP_DATA_
object = Z_REFVAL_P(object);
goto assign_object;
}
object = make_real_object(object, property OPLINE_CC EXECUTE_DATA_CC);
if (UNEXPECTED(!object)) {
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
zend_throw_non_object_error(object, property OPLINE_CC EXECUTE_DATA_CC);
value = &EG(uninitialized_zval);
goto free_and_exit_assign_obj;
}
assign_object:

4
Zend/zend_vm_gen.php

@ -77,7 +77,7 @@ $vm_op_flags = array(
"ZEND_VM_EXT_ARRAY_INIT" => 1<<19,
"ZEND_VM_EXT_REF" => 1<<20,
"ZEND_VM_EXT_FETCH_REF" => 1<<21,
"ZEND_VM_EXT_DIM_OBJ_WRITE" => 1<<22,
"ZEND_VM_EXT_DIM_WRITE" => 1<<22,
"ZEND_VM_EXT_MASK" => 0x0f000000,
"ZEND_VM_EXT_NUM" => 0x01000000,
"ZEND_VM_EXT_LAST_CATCH" => 0x02000000,
@ -134,7 +134,7 @@ $vm_ext_decode = array(
"FETCH_REF" => ZEND_VM_EXT_FETCH_REF,
"SRC" => ZEND_VM_EXT_SRC,
"CACHE_SLOT" => ZEND_VM_EXT_CACHE_SLOT,
"DIM_OBJ_WRITE" => ZEND_VM_EXT_DIM_OBJ_WRITE,
"DIM_WRITE" => ZEND_VM_EXT_DIM_WRITE,
);
$vm_kind_name = array(

2
Zend/zend_vm_opcodes.h

@ -54,7 +54,7 @@
#define ZEND_VM_EXT_ARRAY_INIT 0x00080000
#define ZEND_VM_EXT_REF 0x00100000
#define ZEND_VM_EXT_FETCH_REF 0x00200000
#define ZEND_VM_EXT_DIM_OBJ_WRITE 0x00400000
#define ZEND_VM_EXT_DIM_WRITE 0x00400000
#define ZEND_VM_EXT_MASK 0x0f000000
#define ZEND_VM_EXT_NUM 0x01000000
#define ZEND_VM_EXT_LAST_CATCH 0x02000000

13
ext/dom/tests/bug47430.phpt

@ -11,7 +11,11 @@ $dom->loadXML($xml);
$elements = $dom->getElementsByTagName('i');
foreach ($elements as $i) {
$i->previousSibling->nodeValue = '';
try {
$i->previousSibling->nodeValue = '';
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
}
$arr = array();
@ -20,10 +24,9 @@ $arr[0] = 'Value';
print_r($arr);
?>
--EXPECTF--
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
--EXPECT--
Attempt to assign property 'nodeValue' of non-object
Attempt to assign property 'nodeValue' of non-object
Array
(
[0] => Value

4
ext/opcache/Optimizer/zend_dfg.c

@ -123,10 +123,6 @@ int zend_build_dfg(const zend_op_array *op_array, const zend_cfg *cfg, zend_dfg
case ZEND_FETCH_DIM_RW:
case ZEND_FETCH_DIM_FUNC_ARG:
case ZEND_FETCH_DIM_UNSET:
case ZEND_FETCH_OBJ_W:
case ZEND_FETCH_OBJ_RW:
case ZEND_FETCH_OBJ_FUNC_ARG:
case ZEND_FETCH_OBJ_UNSET:
case ZEND_FETCH_LIST_W:
case ZEND_VERIFY_RETURN_TYPE:
case ZEND_PRE_INC_OBJ:

4
ext/opcache/Optimizer/zend_dump.c

@ -578,14 +578,12 @@ static void zend_dump_op(const zend_op_array *op_array, const zend_basic_block *
fprintf(stderr, " (ref)");
}
}
if ((ZEND_VM_EXT_DIM_OBJ_WRITE|ZEND_VM_EXT_FETCH_REF) & flags) {
if ((ZEND_VM_EXT_DIM_WRITE|ZEND_VM_EXT_FETCH_REF) & flags) {
uint32_t obj_flags = opline->extended_value & ZEND_FETCH_OBJ_FLAGS;
if (obj_flags == ZEND_FETCH_REF) {
fprintf(stderr, " (ref)");
} else if (obj_flags == ZEND_FETCH_DIM_WRITE) {
fprintf(stderr, " (dim write)");
} else if (obj_flags == ZEND_FETCH_OBJ_WRITE) {
fprintf(stderr, " (obj write)");
}
}
}

59
ext/opcache/Optimizer/zend_inference.c

@ -3361,6 +3361,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_FETCH_LIST_R:
case ZEND_FETCH_LIST_W:
if (ssa_ops[i].op1_def >= 0) {
uint32_t key_type = 0;
tmp = t1 & ~(MAY_BE_RC1|MAY_BE_RCN);
if (opline->opcode == ZEND_FETCH_DIM_W ||
opline->opcode == ZEND_FETCH_DIM_RW ||
@ -3382,20 +3383,20 @@ static int zend_update_type_info(const zend_op_array *op_array,
tmp |= t1 & (MAY_BE_RC1|MAY_BE_RCN);
}
if (opline->op2_type == IS_UNUSED) {
tmp |= MAY_BE_ARRAY_KEY_LONG;
key_type |= MAY_BE_ARRAY_KEY_LONG;
} else {
if (t2 & (MAY_BE_LONG|MAY_BE_FALSE|MAY_BE_TRUE|MAY_BE_RESOURCE|MAY_BE_DOUBLE)) {
tmp |= MAY_BE_ARRAY_KEY_LONG;
key_type |= MAY_BE_ARRAY_KEY_LONG;
}
if (t2 & MAY_BE_STRING) {
tmp |= MAY_BE_ARRAY_KEY_STRING;
key_type |= MAY_BE_ARRAY_KEY_STRING;
if (opline->op2_type != IS_CONST) {
// FIXME: numeric string
tmp |= MAY_BE_ARRAY_KEY_LONG;
key_type |= MAY_BE_ARRAY_KEY_LONG;
}
}
if (t2 & (MAY_BE_UNDEF | MAY_BE_NULL)) {
tmp |= MAY_BE_ARRAY_KEY_STRING;
key_type |= MAY_BE_ARRAY_KEY_STRING;
}
}
} else if (opline->opcode == ZEND_FETCH_DIM_UNSET) {
@ -3419,19 +3420,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_FETCH_LIST_W:
case ZEND_ASSIGN_DIM:
case ZEND_ASSIGN_DIM_OP:
tmp |= MAY_BE_ARRAY | MAY_BE_ARRAY_OF_ARRAY;
break;
case ZEND_FETCH_OBJ_W:
case ZEND_FETCH_OBJ_RW:
case ZEND_FETCH_OBJ_FUNC_ARG:
case ZEND_ASSIGN_OBJ:
case ZEND_ASSIGN_OBJ_OP:
case ZEND_ASSIGN_OBJ_REF:
case ZEND_PRE_INC_OBJ:
case ZEND_PRE_DEC_OBJ:
case ZEND_POST_INC_OBJ:
case ZEND_POST_DEC_OBJ:
tmp |= MAY_BE_ARRAY_OF_OBJECT;
tmp |= key_type | MAY_BE_ARRAY | MAY_BE_ARRAY_OF_ARRAY;
break;
case ZEND_SEND_VAR_EX:
case ZEND_SEND_FUNC_ARG:
@ -3446,7 +3435,7 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_VERIFY_RETURN_TYPE:
case ZEND_MAKE_REF:
case ZEND_FE_RESET_RW:
tmp |= MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
tmp |= key_type | MAY_BE_ARRAY_OF_ANY | MAY_BE_ARRAY_OF_REF;
break;
case ZEND_PRE_INC:
case ZEND_PRE_DEC:
@ -3454,11 +3443,24 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_POST_DEC:
if (tmp & MAY_BE_ARRAY_OF_LONG) {
/* may overflow */
tmp |= MAY_BE_ARRAY_OF_DOUBLE;
tmp |= key_type | MAY_BE_ARRAY_OF_DOUBLE;
} else if (!(tmp & (MAY_BE_ARRAY_OF_LONG|MAY_BE_ARRAY_OF_DOUBLE))) {
tmp |= MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE;
tmp |= key_type | MAY_BE_ARRAY_OF_LONG | MAY_BE_ARRAY_OF_DOUBLE;
}
break;
case ZEND_FETCH_OBJ_W:
case ZEND_FETCH_OBJ_RW:
case ZEND_FETCH_OBJ_FUNC_ARG:
case ZEND_ASSIGN_OBJ:
case ZEND_ASSIGN_OBJ_OP:
case ZEND_ASSIGN_OBJ_REF:
case ZEND_PRE_INC_OBJ:
case ZEND_PRE_DEC_OBJ:
case ZEND_POST_INC_OBJ:
case ZEND_POST_DEC_OBJ:
/* These will result in an error exception, unless the element
* is already an object. */
break;
case ZEND_SEND_VAR:
/* This can occur if a DIM_FETCH_FUNC_ARG with UNUSED op2 is left
* behind, because it can't be converted to DIM_FETCH_R. */
@ -3508,21 +3510,6 @@ static int zend_update_type_info(const zend_op_array *op_array,
case ZEND_FETCH_OBJ_W:
case ZEND_FETCH_OBJ_UNSET:
case ZEND_FETCH_OBJ_FUNC_ARG:
if (ssa_ops[i].op1_def >= 0) {
tmp = t1;
if (opline->opcode == ZEND_FETCH_OBJ_W ||
opline->opcode == ZEND_FETCH_OBJ_RW ||
opline->opcode == ZEND_FETCH_OBJ_FUNC_ARG) {
if (opline->opcode != ZEND_FETCH_DIM_FUNC_ARG) {
if (t1 & (MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE)) {
tmp &= ~(MAY_BE_UNDEF|MAY_BE_NULL|MAY_BE_FALSE);
tmp |= MAY_BE_OBJECT | MAY_BE_RC1 | MAY_BE_RCN;
}
}
}
UPDATE_SSA_TYPE(tmp, ssa_ops[i].op1_def);
COPY_SSA_OBJ_TYPE(ssa_ops[i].op1_use, ssa_ops[i].op1_def);
}
if (ssa_ops[i].result_def >= 0) {
tmp = zend_fetch_prop_type(script,
zend_fetch_prop_info(op_array, ssa, opline, i), &ce);

4
ext/opcache/Optimizer/zend_ssa.c

@ -742,10 +742,6 @@ static int zend_ssa_rename(const zend_op_array *op_array, uint32_t build_flags,
case ZEND_FETCH_DIM_RW:
case ZEND_FETCH_DIM_FUNC_ARG:
case ZEND_FETCH_DIM_UNSET:
case ZEND_FETCH_OBJ_W:
case ZEND_FETCH_OBJ_RW:
case ZEND_FETCH_OBJ_FUNC_ARG:
case ZEND_FETCH_OBJ_UNSET:
case ZEND_FETCH_LIST_W:
if (opline->op1_type == IS_CV) {
ssa_ops[k].op1_def = ssa_vars_count;

12
ext/opcache/tests/assign_obj_op_of_fetch_dim.phpt

@ -8,13 +8,13 @@ function test() {
$ary[0]->y += 2;
var_dump(is_object($ary[0]));
}
test();
try {
test();
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Notice: Undefined offset: 0 in %s on line %d
Warning: Creating default object from empty value in %s on line %d
Notice: Undefined property: stdClass::$y in %s on line %d
bool(true)
Attempt to assign property 'y' of non-object

42
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) ""

5
ext/standard/tests/general_functions/var_export_error2.phpt

@ -8,11 +8,12 @@ Test var_export() function : error conditions - recursive object
* Alias to functions:
*/
@$obj->p =& $obj;
$obj = new stdClass;
$obj->p =& $obj;
var_export($obj, true);
?>
===DONE===
--EXPECTF--
Warning: var_export does not handle circular references in %s on line 9
Warning: var_export does not handle circular references in %s on line 10
===DONE===

156
tests/classes/implicit_instantiation_001.phpt

@ -1,156 +0,0 @@
--TEST--
Implicit object instantiation when accessing properties of non-object.
--FILE--
<?php
class C {
// These values get implicitly converted to objects
public $boolFalse = false;
public $emptyString = '';
public $null = null;
// These values do not get implicitly converted to objects
public $boolTrue = true;
public $nonEmptyString = 'hello';
public $intZero = 0;
}
$c = new C;
foreach($c as $name => $value) {
echo "\n\n---( \$c->$name )---";
echo "\n --> Attempting implicit conversion to object using increment...\n";
$c->$name->prop++;
$c->$name = $value; // reset value in case implicit conversion was successful
echo "\n --> Attempting implicit conversion to object using assignment...\n";
$c->$name->prop = "Implicit instantiation!";
$c->$name = $value; // reset value in case implicit conversion was successful
echo "\n --> Attempting implicit conversion to object using combined assignment...\n";
$c->$name->prop .= " Implicit instantiation!";
}
echo "\n\n\n --> Resulting object:";
var_dump($c);
?>
--EXPECTF--
---( $c->boolFalse )---
--> Attempting implicit conversion to object using increment...
Warning: Creating default object from empty value in %s on line 18
Notice: Undefined property: stdClass::$prop in %s on line 18
--> Attempting implicit conversion to object using assignment...
Warning: Creating default object from empty value in %s on line 22
--> Attempting implicit conversion to object using combined assignment...
Warning: Creating default object from empty value in %s on line 26
Notice: Undefined property: stdClass::$prop in %s on line 26
---( $c->emptyString )---
--> Attempting implicit conversion to object using increment...
Warning: Creating default object from empty value in %s on line 18
Notice: Undefined property: stdClass::$prop in %s on line 18
--> Attempting implicit conversion to object using assignment...
Warning: Creating default object from empty value in %s on line 22
--> Attempting implicit conversion to object using combined assignment...
Warning: Creating default object from empty value in %s on line 26
Notice: Undefined property: stdClass::$prop in %s on line 26
---( $c->null )---
--> Attempting implicit conversion to object using increment...
Warning: Creating default object from empty value in %s on line 18
Notice: Undefined property: stdClass::$prop in %s on line 18
--> Attempting implicit conversion to object using assignment...
Warning: Creating default object from empty value in %s on line 22
--> Attempting implicit conversion to object using combined assignment...
Warning: Creating default object from empty value in %s on line 26
Notice: Undefined property: stdClass::$prop in %s on line 26
---( $c->boolTrue )---
--> Attempting implicit conversion to object using increment...
Warning: Attempt to %s property 'prop' of non-object in %s on line 18
--> Attempting implicit conversion to object using assignment...
Warning: Attempt to assign property 'prop' of non-object in %s on line 22
--> Attempting implicit conversion to object using combined assignment...
Warning: Attempt to assign property 'prop' of non-object in %s on line 26
---( $c->nonEmptyString )---
--> Attempting implicit conversion to object using increment...
Warning: Attempt to %s property 'prop' of non-object in %s on line 18
--> Attempting implicit conversion to object using assignment...
Warning: Attempt to assign property 'prop' of non-object in %s on line 22
--> Attempting implicit conversion to object using combined assignment...
Warning: Attempt to assign property 'prop' of non-object in %s on line 26
---( $c->intZero )---
--> Attempting implicit conversion to object using increment...
Warning: Attempt to %s property 'prop' of non-object in %s on line 18
--> Attempting implicit conversion to object using assignment...
Warning: Attempt to assign property 'prop' of non-object in %s on line 22
--> Attempting implicit conversion to object using combined assignment...
Warning: Attempt to assign property 'prop' of non-object in %s on line 26
--> Resulting object:object(C)#%d (6) {
["boolFalse"]=>
object(stdClass)#%d (1) {
["prop"]=>
string(24) " Implicit instantiation!"
}
["emptyString"]=>
object(stdClass)#%d (1) {
["prop"]=>
string(24) " Implicit instantiation!"
}
["null"]=>
object(stdClass)#%d (1) {
["prop"]=>
string(24) " Implicit instantiation!"
}
["boolTrue"]=>
bool(true)
["nonEmptyString"]=>
string(5) "hello"
["intZero"]=>
int(0)
}

3
tests/lang/bug24499.phpt

@ -12,7 +12,8 @@ class Id {
}
$id = new Id();
@$obj->foo = "bar";
$obj = new stdClass;
$obj->foo = "bar";
$id->tester($obj);
print_r($obj);
?>

8
tests/lang/bug7515.phpt

@ -1,14 +1,13 @@
--TEST--
Bug #7515 (weird & invisible referencing of objects)
--INI--
error_reporting=2039
--FILE--
<?php
class obj {
function method() {}
}
$o->root=new obj();
$o = new stdClass;
$o->root = new obj();
ob_start();
var_dump($o);
@ -30,6 +29,5 @@ y=$y
";
}
?>
--EXPECTF--
Warning: Creating default object from empty value in %s on line %d
--EXPECT--
success

28
tests/lang/engine_assignExecutionOrder_008.phpt

@ -29,18 +29,24 @@ echo $a[$i[0][0]=f()][++$i[0][0]];
unset($i);
echo "\n" . '$i->p=f(): ';
$i = new stdClass;
echo $a[$i->p=f()][++$i->p];
unset($i);
echo "\n" . '$i->p->q=f(): ';
$i = new stdClass;
$i->p = new stdClass;
echo $a[$i->p->q=f()][++$i->p->q];
unset($i);
echo "\n" . '$i->p[0]=f(): ';
$i = new stdClass;
echo $a[$i->p[0]=f()][++$i->p[0]];
unset($i);
echo "\n" . '$i->p[0]->p=f(): ';
$i = new stdClass;
$i->p[0] = new stdClass;
echo $a[$i->p[0]->p=f()][++$i->p[0]->p];
unset($i);
@ -59,28 +65,16 @@ echo "\n" . 'C::$p->q=f(): ';
C::$p = new stdclass;
echo $a[C::$p->q=f()][++C::$p->q];
?>
--EXPECTF--
--EXPECT--
$i=f(): good
$$x=f(): good
${'i'}=f(): good
$i[0]=f(): good
$i[0][0]=f(): good
$i->p=f():
Warning: Creating default object from empty value in %s on line %d
good
$i->p->q=f():
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
good
$i->p[0]=f():
Warning: Creating default object from empty value in %s on line %d
good
$i->p[0]->p=f():
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
good
$i->p=f(): good
$i->p->q=f(): good
$i->p[0]=f(): good
$i->p[0]->p=f(): good
C::$p=f(): good
C::$p[0]=f(): good
C::$p->q=f(): good

26
tests/lang/foreachLoop.016.phpt

@ -46,6 +46,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset($a, $b);
echo "\n" . '$a->b' . "\n";
$a = new stdClass;
$b = $a->b = array('original');
foreach($a->b as $k=>&$v) {
$v = 'changed';
@ -54,6 +55,8 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset($a, $b);
echo "\n" . '$a->b->c' . "\n";
$a = new stdClass;
$a->b = new stdClass;
$b = $a->b->c = array('original');
foreach($a->b as $k=>&$v) {
$v = 'changed';
@ -62,6 +65,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset($a, $b);
echo "\n" . '$a->b[0]' . "\n";
$a = new stdClass;
$b = $a->b[0] = array('original');
foreach($a->b[0] as $k=>&$v) {
$v = 'changed';
@ -70,6 +74,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset($a, $b);
echo "\n" . '$a->b[0][0]' . "\n";
$a = new stdClass;
$b = $a->b[0][0] = array('original');
foreach($a->b[0][0] as $k=>&$v) {
$v = 'changed';
@ -78,6 +83,8 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset($a, $b);
echo "\n" . '$a->b[0]->c' . "\n";
$a = new stdClass;
$a->b[0] = new stdClass;
$b = $a->b[0]->c = array('original');
foreach($a->b[0]->c as $k=>&$v) {
$v = 'changed';
@ -108,6 +115,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
unset(C::$a[0], $b);
echo "\n" . 'C::$a[0]->b' . "\n";
C::$a[0] = new stdClass;
C::$a[0]->b = array('original');
$b = C::$a[0]->b;
foreach(C::$a[0]->b as $k=>&$v) {
@ -116,7 +124,7 @@ Ensure foreach splits the iterated entity from its cow reference set, for all so
var_dump($b);
unset(C::$a[0]->b, $b);
?>
--EXPECTF--
--EXPECT--
$a
array(1) {
[0]=>
@ -148,44 +156,30 @@ array(1) {
}
$a->b
Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b->c
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b[0]
Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b[0][0]
Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
}
$a->b[0]->c
Warning: Creating default object from empty value in %s on line %d
Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"
@ -204,8 +198,6 @@ array(1) {
}
C::$a[0]->b
Warning: Creating default object from empty value in %s on line %d
array(1) {
[0]=>
string(8) "original"

180
tests/lang/passByReference_006.phpt

@ -3,78 +3,54 @@ Pass uninitialised objects and arrays by reference to test implicit initialisati
--FILE--
<?php
function refs(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) {
function refs(&$ref1, &$ref2) {
$ref1 = "Ref1 changed";
$ref2 = "Ref2 changed";
$ref3 = "Ref3 changed";
$ref4 = "Ref4 changed";
$ref5 = "Ref5 changed";
}
class C {
function __construct(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) {
function __construct(&$ref1, &$ref2) {
$ref1 = "Ref1 changed";
$ref2 = "Ref2 changed";
$ref3 = "Ref3 changed";
$ref4 = "Ref4 changed";
$ref5 = "Ref5 changed";
}
function refs(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) {
function refs(&$ref1, &$ref2) {
$ref1 = "Ref1 changed";
$ref2 = "Ref2 changed";
$ref3 = "Ref3 changed";
$ref4 = "Ref4 changed";
$ref5 = "Ref5 changed";
}
static function static_refs(&$ref1, &$ref2, &$ref3, &$ref4, &$ref5) {
static function static_refs(&$ref1, &$ref2) {
$ref1 = "Ref1 changed";
$ref2 = "Ref2 changed";
$ref3 = "Ref3 changed";
$ref4 = "Ref4 changed";
$ref5 = "Ref5 changed";
}
}
echo "\n ---- Pass uninitialised array & object by ref: function call ---\n";
unset($u1, $u2, $u3, $u4, $u5);
refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
var_dump($u1, $u2, $u3, $u4, $u5);
unset($u1, $u2);
refs($u1[0], $u2[0][1]);
var_dump($u1, $u2);
echo "\n ---- Pass uninitialised arrays & objects by ref: static method call ---\n";
unset($u1, $u2, $u3, $u4, $u5);
C::static_refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
var_dump($u1, $u2, $u3, $u4, $u5);
unset($u1, $u2);
C::static_refs($u1[0], $u2[0][1]);
var_dump($u1, $u2);
echo "\n\n---- Pass uninitialised arrays & objects by ref: constructor ---\n";
unset($u1, $u2, $u3, $u4, $u5);
$c = new C($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
var_dump($u1, $u2, $u3, $u4, $u5);
unset($u1, $u2);
$c = new C($u1[0], $u2[0][1]);
var_dump($u1, $u2);
echo "\n ---- Pass uninitialised arrays & objects by ref: instance method call ---\n";
unset($u1, $u2, $u3, $u4, $u5);
$c->refs($u1[0], $u2[0][1], $u3->a, $u4->a->b, $u5->a->b->c);
var_dump($u1, $u2, $u3, $u4, $u5);
unset($u1, $u2);
$c->refs($u1[0], $u2[0][1]);
var_dump($u1, $u2);
?>
--EXPECTF--
---- Pass uninitialised array & object by ref: function call ---
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
--EXPECT--
---- Pass uninitialised array & object by ref: function call ---
array(1) {
[0]=>
string(12) "Ref1 changed"
@ -86,41 +62,8 @@ array(1) {
string(12) "Ref2 changed"
}
}
object(stdClass)#%d (1) {
["a"]=>
string(12) "Ref3 changed"
}
object(stdClass)#%d (1) {
["a"]=>
object(stdClass)#%d (1) {
["b"]=>
string(12) "Ref4 changed"
}
}
object(stdClass)#%d (1) {
["a"]=>
object(stdClass)#%d (1) {
["b"]=>
object(stdClass)#%d (1) {
["c"]=>
string(12) "Ref5 changed"
}
}
}
---- Pass uninitialised arrays & objects by ref: static method call ---
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@ -132,42 +75,9 @@ array(1) {
string(12) "Ref2 changed"
}
}
object(stdClass)#%d (1) {
["a"]=>
string(12) "Ref3 changed"
}
object(stdClass)#%d (1) {
["a"]=>
object(stdClass)#%d (1) {
["b"]=>
string(12) "Ref4 changed"
}
}
object(stdClass)#%d (1) {
["a"]=>
object(stdClass)#%d (1) {
["b"]=>
object(stdClass)#%d (1) {
["c"]=>
string(12) "Ref5 changed"
}
}
}
---- Pass uninitialised arrays & objects by ref: constructor ---
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@ -179,41 +89,8 @@ array(1) {
string(12) "Ref2 changed"
}
}
object(stdClass)#%d (1) {
["a"]=>
string(12) "Ref3 changed"
}
object(stdClass)#%d (1) {
["a"]=>
object(stdClass)#%d (1) {
["b"]=>
string(12) "Ref4 changed"
}
}
object(stdClass)#%d (1) {
["a"]=>
object(stdClass)#%d (1) {
["b"]=>
object(stdClass)#%d (1) {
["c"]=>
string(12) "Ref5 changed"
}
}
}
---- Pass uninitialised arrays & objects by ref: instance method call ---
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
Warning: Creating default object from empty value in %spassByReference_006.php on line %d
array(1) {
[0]=>
string(12) "Ref1 changed"
@ -225,24 +102,3 @@ array(1) {
string(12) "Ref2 changed"
}
}
object(stdClass)#%d (1) {
["a"]=>
string(12) "Ref3 changed"
}
object(stdClass)#%d (1) {
["a"]=>
object(stdClass)#%d (1) {
["b"]=>
string(12) "Ref4 changed"
}
}
object(stdClass)#%d (1) {
["a"]=>
object(stdClass)#%d (1) {
["b"]=>
object(stdClass)#%d (1) {
["c"]=>
string(12) "Ref5 changed"
}
}
}
Loading…
Cancel
Save