php-src/sapi
Niels Dossche 8a812c3fda 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.
2023-09-20 21:02:51 +02:00
..
apache2handler Implement GH-10854: TSRM should set a smarter value for expected_threads (#10867) 2023-03-17 17:08:47 +01:00
cgi Align highlight_string|file with HTML standard and modern browsers 2023-08-12 15:08:28 +01:00
cli [skip ci] Fix typos discovered by codespell (#12228) 2023-09-18 11:07:17 +01:00
embed main/SAPI: make "ini_entries" a const string 2023-01-04 12:49:48 +00:00
fpm Fix too many arguments in FPM ACL compile check (#12242) 2023-09-19 18:52:34 +01:00
fuzzer Fix -Wstrict-prototypes warnings in fuzzer SAPI (#11277) 2023-05-20 11:43:30 +02:00
litespeed Fix GH-11141: Could not open input file: should be sent to stderr 2023-05-05 19:31:23 +02:00
phpdbg Fix GH-12215: Module entry being overwritten causes type errors in ext/dom (PHP 8.4) 2023-09-20 21:02:51 +02:00