Skip to content

Commit

Permalink
Merge branch 'PHP-8.3'
Browse files Browse the repository at this point in the history
* PHP-8.3:
  Tweak behaviour of dynamic properties wrt error handlers
  • Loading branch information
nielsdos committed Sep 3, 2023
2 parents c0b3cbf + eee1617 commit e2189e5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
20 changes: 20 additions & 0 deletions Zend/tests/oss_fuzz_61712b.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--TEST--
OSS-Fuzz #61712 (assertion failure with error handler during binary op)
--FILE--
<?php
#[AllowDynamicProperties]
class C {
function error($_, $msg) {
echo $msg, "\n";
$this->a = 12345;
}
}

$c = new C;
set_error_handler([$c, 'error']);
$c->a %= 10;
var_dump($c->a);
?>
--EXPECT--
Undefined property: C::$a
int(5)
2 changes: 1 addition & 1 deletion Zend/zend_object_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam
if (UNEXPECTED(type == BP_VAR_RW || type == BP_VAR_R)) {
zend_error(E_WARNING, "Undefined property: %s::$%s", ZSTR_VAL(zobj->ce->name), ZSTR_VAL(name));
}
retval = zend_hash_update(zobj->properties, name, &EG(uninitialized_zval));
retval = zend_hash_add(zobj->properties, name, &EG(uninitialized_zval));
}
} else if (zobj->ce->__get == NULL) {
retval = &EG(error_zval);
Expand Down

0 comments on commit e2189e5

Please sign in to comment.