mirror of
https://github.com/php/php-src.git
synced 2026-04-02 21:52:36 +02:00
Fix handling of UNDEF properties in compound assign
Restore NULLing of UNDEF values in get_property_ptr_ptr for the BP_VAR_R and BP_VAR_RW cases.
This commit is contained in:
22
Zend/tests/type_declarations/typed_properties_103.phpt
Normal file
22
Zend/tests/type_declarations/typed_properties_103.phpt
Normal file
@@ -0,0 +1,22 @@
|
||||
--TEST--
|
||||
Handling of UNDEF property in compound assign
|
||||
--FILE--
|
||||
<?php
|
||||
class C {
|
||||
public $a = 0;
|
||||
}
|
||||
function foo() {
|
||||
$x = new C;
|
||||
$x->a = 1;
|
||||
unset($x->a);
|
||||
$x->a += 2;
|
||||
var_dump($x);
|
||||
}
|
||||
foo();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Notice: Undefined property: C::$a in %s on line %d
|
||||
object(C)#1 (1) {
|
||||
["a"]=>
|
||||
int(2)
|
||||
}
|
||||
@@ -1018,6 +1018,7 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int typ
|
||||
if (EXPECTED(!zobj->ce->__get) ||
|
||||
UNEXPECTED((*zend_get_property_guard(zobj, name)) & IN_GET)) {
|
||||
if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
|
||||
ZVAL_NULL(retval);
|
||||
zend_error(E_NOTICE, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user