php-src/Zend/tests/oss_fuzz_61712.phpt
Niels Dossche a3a3964497 Fix oss-fuzz #61712: assertion failure with error handler during binary op
Because the error handler is invoked after the property is updated,
the error handler has the opportunity to remove it before the property
is returned.

Switching the order around fixes this issue. The comments mention that
the current ordering prevents overwriting the EG(std_property_info)
field in the error handler. EG(std_property_info) no longer exists as it
was removed in 7471c217. Back then a global was used to store the
returned property info, but as this is no longer the case there is no
longer a need to protect against overwriting a global.

Closes GH-12062.
2023-08-28 20:00:49 +02:00

21 lines
345 B
PHP

--TEST--
OSS-Fuzz #61712 (assertion failure with error handler during binary op)
--FILE--
<?php
#[AllowDynamicProperties]
class C {
function error($_, $msg) {
echo $msg, "\n";
unset($this->a);
}
}
$c = new C;
set_error_handler([$c, 'error']);
$c->a %= 10;
var_dump($c->a);
?>
--EXPECT--
Undefined property: C::$a
int(0)