mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
zend_std_get_property_ptr_ptr() was the only property handler that did
not propagate the IN_GET guard to the underlying object when forwarding
from a lazy proxy after initialization. This caused __get to be called
on the underlying object when it shouldn't be, leading to assertion
failures.
The same guard-copying pattern already existed in read_property,
write_property, unset_property, and has_property since commit
26f5009e91 (GH-18039).
Also fixes GH-20873 and GH-20854.
Closes GH-20875
50 lines
1.4 KiB
PHP
50 lines
1.4 KiB
PHP
--TEST--
|
|
GH-20875 (Assertion failure in _get_zval_ptr_tmp with lazy proxy)
|
|
--FILE--
|
|
<?php
|
|
class A {
|
|
public $_;
|
|
public function __get($name) {
|
|
global $obj;
|
|
$obj->f =& $this->b - $x > $y = new StdClass;
|
|
static $a = $a;
|
|
$t = 'x';
|
|
foreach (get_defined_vars() as $key => $e) {}
|
|
if ($v ==!1) $x = $a ?: $t = "ok";
|
|
}
|
|
}
|
|
$rc = new ReflectionClass(A::class);
|
|
$obj = $rc->newLazyProxy(function () { return new A; });
|
|
$real = $rc->initializeLazyObject($obj);
|
|
var_dump($real->prop);
|
|
?>
|
|
--EXPECTF--
|
|
Deprecated: Creation of dynamic property A::$b is deprecated in %s on line %d
|
|
|
|
Deprecated: Creation of dynamic property A::$f is deprecated in %s on line %d
|
|
|
|
Warning: Undefined variable $x in %s on line %d
|
|
|
|
Notice: Object of class stdClass could not be converted to int in %s on line %d
|
|
|
|
Warning: Undefined variable $a in %s on line %d
|
|
|
|
Warning: Undefined variable $v in %s on line %d
|
|
|
|
Notice: Indirect modification of overloaded property A::$b has no effect in %s on line %d
|
|
|
|
Warning: Undefined variable $x in %s on line %d
|
|
|
|
Notice: Object of class stdClass could not be converted to int in %s on line %d
|
|
|
|
Warning: Undefined variable $v in %s on line %d
|
|
|
|
Notice: Indirect modification of overloaded property A::$f has no effect in %s on line %d
|
|
|
|
Fatal error: Uncaught Error: Cannot assign by reference to overloaded object in %s:%d
|
|
Stack trace:
|
|
#0 %s(%d): A->__get('b')
|
|
#1 %s(%d): A->__get('prop')
|
|
#2 {main}
|
|
thrown in %s on line %d
|