[php-src] master: ext/dom: Resolve constants of a node class when registering it
| From: | Ilia Alshanetsky | Date: | Fri, 20 Nov 2026 00:06:45 +0000 |
| Subject: | [php-src] master: ext/dom: Resolve constants of a node class when registering it | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-143947@lists.php.net to get a copy of this message | ||
Author: Ilia Alshanetsky (iliaal)
Date: 2026-11-19T18:55:25-05:00
Commit: https://github.com/php/php-src/commit/51d440cbc62f51514758611e269c9a938c031095
Raw diff: https://github.com/php/php-src/commit/51d440cbc62f51514758611e269c9a938c031095.diff
ext/dom: Resolve constants of a node class when registering it
object_init_ex() fails when a class has a constant expression that cannot
be evaluated, such as a property default naming an undefined constant.
php_dom_instantiate_object_helper() does not check for that failure, so a
class registered with registerNodeClass() crashed the first time a node
wrapper of that class was created. Evaluate the constants in
registerNodeClass() and throw there, as is already done for abstract
classes, so that every registered class can be instantiated. Registering
such a class now throws, where it previously succeeded until a node was
created.
Closes GH-25601
Changed paths:
A ext/dom/tests/registerNodeClass_undefined_constant.phpt
M NEWS
M ext/dom/document.c
Diff: