You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Memory leak when calling a static method inside an xpath query #11347
Calling a static method inside an xpath query like so $xpath->query("//a[php:function('MyClass::myMethod()')]")
generates a memory leak with PHP 8.1 and PHP 8.2. It used to work fine with PHP 7.2.
I have written a minimal script to reproduce the issue.
It's a type confusion bug, kinda. zend_make_callable may change the function name of the fci to become an array, causing a crash in debug mode on zval_ptr_dtor_str(&fci.function_name); in dom_xpath_ext_function_php. On a production build it doesn't crash but only causes a leak.
I'll also check the other zend_make_callable cases.
Activity
ndossche commentedon May 30, 2023
It's a type confusion bug, kinda.
zend_make_callablemay change the function name of the fci to become an array, causing a crash in debug mode onzval_ptr_dtor_str(&fci.function_name);indom_xpath_ext_function_php. On a production build it doesn't crash but only causes a leak.I'll also check the other
zend_make_callablecases.Fix phpGH-11347: Memory leak when calling a static method inside an x…
Merge branch 'PHP-8.1' into PHP-8.2
Merge branch 'PHP-8.2'
Fix phpGH-11347: Memory leak when calling a static method inside an x…