mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix GH-12215: Module entry being overwritten causes type errors in ext/dom (PHP 8.4)
When we try to load an extension multiple times, we still overwrite the type, module number, and handle. If the module number is used to indicate module boundaries (e.g. in reflection and in dom, see e.g. dom_objects_set_class_ex), then all sorts of errors can happen. In the case of ext/dom, OP's error happens because the following happens: - The property handler is set up incorrectly in dom_objects_set_class_ex() because the wrong module number is specified. The class highest in the hierarchy is DOMNode, so the property handler is incorrectly set to that of DOMNode instead of DOMDocument. - The documentElement property doesn't exist on DOMNode, it only exists on DOMDocument, so it tries to read using zend_std_read_property(). As there is no user property called documentElement, that read operation returns an undef value. However, the type is still checked, resulting in the strange exception. Solve this by changing the API such that the data is only overwritten if it's owned data. Closes GH-12246.
This commit is contained in:
parent
aab6bbc6f5
commit
8a812c3fda
6 changed files with 22 additions and 19 deletions
|
@ -375,7 +375,7 @@ ZEND_API zend_result zend_register_functions(zend_class_entry *scope, const zend
|
|||
ZEND_API void zend_unregister_functions(const zend_function_entry *functions, int count, HashTable *function_table);
|
||||
ZEND_API zend_result zend_startup_module(zend_module_entry *module_entry);
|
||||
ZEND_API zend_module_entry* zend_register_internal_module(zend_module_entry *module_entry);
|
||||
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module);
|
||||
ZEND_API zend_module_entry* zend_register_module_ex(zend_module_entry *module, int module_type);
|
||||
ZEND_API zend_result zend_startup_module_ex(zend_module_entry *module);
|
||||
ZEND_API void zend_startup_modules(void);
|
||||
ZEND_API void zend_collect_module_handlers(void);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue