File tree Expand file tree Collapse file tree 3 files changed +19
-0
lines changed
Expand file tree Collapse file tree 3 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,10 @@ PHP NEWS
99 . Fixed bug GH-17951 (memory_limit is not always limited by max_memory_limit).
1010 (manuelm)
1111
12+ - DOM:
13+ . Fix memory leak when edge case is hit when registering xpath callback.
14+ (ndossche)
15+
1216- Opcache:
1317 . Fixed bug GH-20329 (opcache.file_cache broken with full interned string
1418 buffer). (Arnaud)
Original file line number Diff line number Diff line change 5757 echo $ e ->getMessage (), "\n" ;
5858}
5959
60+ $ x = new class {
61+ public static function dump () {}
62+ };
63+
64+ $ classes = get_declared_classes ();
65+
66+ try {
67+ $ str = str_repeat ($ classes [count ($ classes ) - 1 ] . '::dump ' , random_int (1 , 1 ));
68+ $ xpath ->registerPhpFunctions ([$ str ]);
69+ } catch (Throwable $ e ) {
70+ echo $ e ->getMessage (), "\n" ;
71+ }
72+
6073?>
6174--EXPECT--
6275DOMXPath::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
6780DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
6881DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
6982DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be a valid callback name
83+ DOMXPath::registerPhpFunctions(): Argument #1 ($restrict) must be an array containing valid callback names
Original file line number Diff line number Diff line change @@ -215,6 +215,7 @@ static zend_result php_dom_xpath_callback_ns_update_method_handler(
215215 }
216216 zend_tmp_string_release (tmp_str );
217217 } else {
218+ zend_tmp_string_release (tmp_str );
218219 zend_fcc_dtor (fcc );
219220 efree (fcc );
220221 return FAILURE ;
You can’t perform that action at this time.
0 commit comments