mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.4'
* PHP-8.4: Fix leak when creating cycle in hook
This commit is contained in:
commit
ddfa743aba
2 changed files with 28 additions and 0 deletions
26
Zend/tests/gh18907.phpt
Normal file
26
Zend/tests/gh18907.phpt
Normal 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)
|
|
@ -722,7 +722,9 @@ static bool zend_call_get_hook(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GC_ADDREF(zobj);
|
||||||
zend_call_known_instance_method_with_0_params(get, zobj, rv);
|
zend_call_known_instance_method_with_0_params(get, zobj, rv);
|
||||||
|
OBJ_RELEASE(zobj);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue