Merge branch 'PHP-8.4'

* PHP-8.4:
  Fix leak when creating cycle in hook
This commit is contained in:
Ilija Tovilo 2025-06-23 17:48:36 +02:00
commit ddfa743aba
No known key found for this signature in database
GPG key ID: 115CEA7A713E12E9
2 changed files with 28 additions and 0 deletions

26
Zend/tests/gh18907.phpt Normal file
View file

@ -0,0 +1,26 @@
--TEST--
GH-18907: Leak when creating cycle inside hook
--FILE--
<?php
class Foo {
public $prop {
get {
$this->prop = $this;
return 1;
}
}
}
function test() {
var_dump((new Foo)->prop);
}
/* Call twice to test the ZEND_IS_PROPERTY_HOOK_SIMPLE_GET() path. */
test();
test();
?>
--EXPECT--
int(1)
int(1)

View file

@ -722,7 +722,9 @@ static bool zend_call_get_hook(
return false;
}
GC_ADDREF(zobj);
zend_call_known_instance_method_with_0_params(get, zobj, rv);
OBJ_RELEASE(zobj);
return true;
}