ext/xml: Refactor extension to use FCC instead of zvals for handlers#12340
ext/xml: Refactor extension to use FCC instead of zvals for handlers#12340Girgias merged 26 commits intophp:masterfrom
Conversation
88ad6ff to
01a8927
Compare
|
Related to: php/doc-en#1391 |
|
Pushed fixes, ext/xml tests now pass, but I haven't given this a full review yet (and there's some TODOs, so I'll wait maybe for those) EDIT: this test fails |
1afecb6 to
3c66a18
Compare
ndossche
left a comment
There was a problem hiding this comment.
Looks mostly good, just minor comments.
And a potential BC problem, it's a problem because it's silent imo unlike the other BC change.
7cd23ae to
e260bd6
Compare
f7a6fd4 to
f9ccae9
Compare
…handlers To get proper errors and sensible behaviour, as the current behaviour is somewhat insane and part of it should be axed ASAP
+ Add failing test
Has heap after free and still need more tests, especially around using proper callables for methods on the same class
f9ccae9 to
edc99d5
Compare
ndossche
left a comment
There was a problem hiding this comment.
Looks good apart from two silly nits.
Thanks for working on this.
Use proper callables instead. Related to: php/php-src#12340 Co-authored-by: Konrad Abicht <hi@inspirito.de>
| * @param callable $start_handler | ||
| * @param callable $end_handler | ||
| */ | ||
| function xml_set_element_handler(XMLParser $parser, $start_handler, $end_handler): true {} |
There was a problem hiding this comment.
Hi @Girgias you changed the stub signature from callable to callable|string|null.
Can you confirm this is not a PHP 8.4-related change, and this should have been the original param phpdoc ?
There was a problem hiding this comment.
Yes and no. The string needs to be the name of a method that exists on the object passed to xml_set_object() or the empty string to disable it, however the callability check used to be only performed when attempting to call the method, rather than how a callable type check works on function setting.
So really it is meant to be callable but wasn't due to how the implementation worked, it will be ?callable in PHP 9.
To get proper errors and sensible behaviour, as the current behaviour is somewhat insane and part of it should be axed ASAP
Skipping CI due to known issues and failures regarding the GC and exceptions being swallowed