mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
Merge branch 'PHP-8.5'
* PHP-8.5: Fix memory leak when edge case is hit when registering xpath callback
This commit is contained in:
@@ -57,6 +57,19 @@ try {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
$x = new class {
|
||||
public static function dump() {}
|
||||
};
|
||||
|
||||
$classes = get_declared_classes();
|
||||
|
||||
try {
|
||||
$str = str_repeat($classes[count($classes) - 1] . '::dump', random_int(1, 1));
|
||||
$xpath->registerPhpFunctions([$str]);
|
||||
} catch (Throwable $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a callable, function "nonexistent" not found or invalid function name
|
||||
@@ -67,3 +80,4 @@ DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array with
|
||||
DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
|
||||
DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
|
||||
DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a valid callback name
|
||||
DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
|
||||
|
||||
@@ -215,6 +215,7 @@ static zend_result php_dom_xpath_callback_ns_update_method_handler(
|
||||
}
|
||||
zend_tmp_string_release(tmp_str);
|
||||
} else {
|
||||
zend_tmp_string_release(tmp_str);
|
||||
zend_fcc_dtor(fcc);
|
||||
efree(fcc);
|
||||
return FAILURE;
|
||||
|
||||
Reference in New Issue
Block a user