mirror of
https://github.com/php/php-src.git
synced 2026-04-03 22:22:18 +02:00
Merge branch 'PHP-5.6'
Conflicts: Zend/zend_object_handlers.c
This commit is contained in:
21
Zend/tests/bug68118.phpt
Normal file
21
Zend/tests/bug68118.phpt
Normal file
@@ -0,0 +1,21 @@
|
||||
--TEST--
|
||||
Bug #68118: $a->foo .= 'test'; can leave $a->foo undefined
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
set_error_handler(function() {
|
||||
$obj = new stdClass;
|
||||
$obj->test = 'meow';
|
||||
return true;
|
||||
});
|
||||
|
||||
$a = new stdClass;
|
||||
$a->undefined .= 'test';
|
||||
var_dump($a);
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
object(stdClass)#2 (1) {
|
||||
["undefined"]=>
|
||||
string(4) "test"
|
||||
}
|
||||
@@ -815,10 +815,6 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
|
||||
(guard = zend_get_property_guard(zobj, property_info, member)) == NULL ||
|
||||
(property_info && ((*guard) & IN_GET))) {
|
||||
|
||||
/* we don't have access controls - will just add it */
|
||||
if(UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
|
||||
zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name->val, Z_STRVAL_P(member));
|
||||
}
|
||||
ZVAL_NULL(&tmp);
|
||||
if (EXPECTED((property_info->flags & ZEND_ACC_STATIC) == 0) &&
|
||||
property_info->offset >= 0) {
|
||||
@@ -830,6 +826,12 @@ static zval *zend_std_get_property_ptr_ptr(zval *object, zval *member, int type,
|
||||
}
|
||||
retval = zend_hash_update(zobj->properties, property_info->name, &tmp);
|
||||
}
|
||||
|
||||
/* Notice is thrown after creation of the property, to avoid EG(std_property_info)
|
||||
* being overwritten in an error handler. */
|
||||
if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
|
||||
zend_error(E_NOTICE, "Undefined property: %s::$%s", zobj->ce->name->val, Z_STRVAL_P(member));
|
||||
}
|
||||
} else {
|
||||
/* we do have getter - fail and let it try again with usual get/set */
|
||||
retval = NULL;
|
||||
|
||||
Reference in New Issue
Block a user