355 Commits
Author SHA1 Message Date
Ilija Tovilo 9705fda1bb Merge branch 'PHP-8.6' into master
* PHP-8.6:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:34:56 +02:00
Ilija Tovilo d6373dfe15 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:33:23 +02:00
Ilija Tovilo c7273b9ba8 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:30:04 +02:00
Ilija Tovilo 8a94bb3822 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:27:03 +02:00
Ilija Tovilo c1a5f468d0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add NEWS entry
  Avoid state corruption via bailout
2026-10-21 16:12:35 +02:00
3584a98bda Avoid state corruption via bailout
- Replace bailout on OOM with UnwindExit
- Properly reset various globals that may be accessed during startup

Fix GHSA-w8hw-w9fx-j79w (CVE-2026-109618)
Fix GHSA-6wmf-4rv5-p3rp (CVE-2026-109619)

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
Co-authored-by: Jakub Zelenka <bukka@php.net>
Co-authored-by: Nora Dossche <7771979+ndossche@users.noreply.github.com>
Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
2026-10-21 16:06:22 +02:00
lacatoire b2163be5ff Clear the libxml last error in libxml_use_internal_errors(false)
libxml_use_internal_errors(false) destroyed the internal error list but
left libxml's own last error in place. libxml_get_last_error() falls
back to it once the list is gone, so it kept returning an error while
libxml_get_errors() was empty, although the documentation says that
disabling clears the existing errors.

Reset the last error when the list is destroyed. Calling the function
again while the internal errors are already disabled leaves it alone.

Closes GH-24295.
2026-10-14 22:46:03 +02:00
Ilia Alshanetsky 65f7c719a3 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  ext/libxml: Keep SimpleXML children alive across reconstruction
2026-09-29 14:53:12 -04:00
Ilia Alshanetsky e926c2a2ec Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/libxml: Keep SimpleXML children alive across reconstruction
2026-09-29 14:16:24 -04:00
Ilia Alshanetsky efb8ad276d ext/libxml: Keep SimpleXML children alive across reconstruction
Reconstructing a SimpleXMLElement decremented the shared node and then
installed a new document while the old pointer was still set, so the
second decrement freed a node a child object still held. Clear the
pointer before the new node is installed.

Closes GH-23931
2026-09-29 14:06:21 -04:00
Shivam Mathur e783539fe5 Merge branch 'PHP-8.5'
* PHP-8.5:
  Avoid closing libxml output encoder twice (#23678)
2026-09-13 23:30:49 +05:30
Shivam Mathur 2f0362e2b1 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Avoid closing libxml output encoder twice (#23678)
2026-09-13 23:30:15 +05:30
Shivam Mathur c36758eefb Avoid closing libxml output encoder twice (#23678) 2026-09-13 23:29:47 +05:30
Dmytro Kulyk 67135cb97b gen_stub: Conditionally include zend_attributes.h to arginfo based on usage (#21570)
Headers required by the generated code (zend_attributes.h, zend_constants.h, zend_enum.h) are collected during generation and emitted as includes at the top of the arginfo file, with the same preprocessor conditions and PHP version guards as the code that needs them.

Removes the manual zend_attributes.h and zend_enum.h includes from sources that only needed them for the arginfo file they include.
2026-09-06 21:25:20 +02:00
Ben Ramsey c2af0976a8 license-update: ext/libxml source headers
RFC: https://wiki.php.net/rfc/php_license_update
2026-04-11 21:20:54 -05:00
Khaled Alam d03d69a88a Remove duplicate #include statements (#21085)
* Remove duplicate #include statements across the codebase.

* feat: Restore conditional/unconditional include pairs in lscriu.c
2026-01-30 16:37:13 +01:00
Ilija Tovilo ddc8512267 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Suppress libxml deprecations
2025-12-02 16:45:39 +01:00
Ilija Tovilo ed847f49c3 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Suppress libxml deprecations
2025-12-02 16:45:31 +01:00
Ilija Tovilo 685bd9de81 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Suppress libxml deprecations
2025-12-02 16:41:37 +01:00
Ilija Tovilo 26b9395ad6 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Suppress libxml deprecations
2025-12-02 16:38:08 +01:00
Ilija Tovilo f7fb13eb07 Suppress libxml deprecations
Closes GH-20538
2025-12-02 16:37:50 +01:00
Niels Dossche aa9619e437 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  libxml: Fix input buffer deprecation
2025-11-19 18:41:50 +01:00
Niels Dossche 6eb10dc433 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  libxml: Fix input buffer deprecation
2025-11-19 18:41:43 +01:00
Niels Dossche 8c2407714f libxml: Fix input buffer deprecation
While this fixed the last deprecation in ext/libxml, it's not a full
fix: The full fix would be to move to the context-specific APIs to
override the behaviour. However, that requires API/ABI incompatible
changes so that can't be done on a stable branch.

Closes GH-20525.
2025-11-19 18:41:28 +01:00
Niels Dossche 39dc317f1f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  libxml: Fix some deprecations regarding input buffer/parser handling
2025-11-18 18:54:03 +01:00
Niels Dossche 4401b03aa9 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  libxml: Fix some deprecations regarding input buffer/parser handling
2025-11-18 18:53:44 +01:00
Niels Dossche 6054a900ff libxml: Fix some deprecations regarding input buffer/parser handling
Closes GH-20514.
2025-11-18 18:53:17 +01:00
Niels Dossche f601910eca Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Wrap the normally lazy-initialized components in ZTS
2025-10-14 22:15:10 +02:00
Niels Dossche 6dcabd9ac1 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Wrap the normally lazy-initialized components in ZTS
2025-10-14 22:15:01 +02:00
Niels Dossche f3cb9a81fb Wrap the normally lazy-initialized components in ZTS 2025-10-14 22:14:54 +02:00
Niels Dossche 5a2084bc16 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix not thread safe RelaxNG invocations in ZTS builds
  Fix not thread safe xmlSchemaParse calls in ZTS builds
2025-10-14 22:01:04 +02:00
Niels Dossche 595b746c2c Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix not thread safe RelaxNG invocations in ZTS builds
  Fix not thread safe xmlSchemaParse calls in ZTS builds
2025-10-14 22:00:57 +02:00
Niels Dossche 75d8449d1f Fix not thread safe RelaxNG invocations in ZTS builds 2025-10-14 22:00:24 +02:00
SpencerMalone f14e5fcfbd Fix not thread safe xmlSchemaParse calls in ZTS builds
By calling xmlSchemaInitTypes during MINIT.
See: https://gitlab.gnome.org/GNOME/libxml2/-/issues/930

Closes GH-20150.
2025-10-14 21:59:46 +02:00
Niels Dossche 541620cf78 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-19098: libxml<2.13 segmentation fault caused by php_libxml_node_free
2025-07-20 17:20:53 +02:00
Niels Dossche cb73155945 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-19098: libxml<2.13 segmentation fault caused by php_libxml_node_free
2025-07-20 17:20:47 +02:00
Niels Dossche 312869381a Fix GH-19098: libxml<2.13 segmentation fault caused by php_libxml_node_free
This implements a workaround for reconciliation not being performed for
document-less nodes in libxml<2.13.

Closes GH-19186.
2025-07-20 17:19:43 +02:00
Niels Dossche 0962c325fa Implement SVG image handler
This implements an SVG handler using the libxml reader API. This does
not parse the entire document but instead uses a pull parser to locate
the root element, check whether it's an svg root, do some extra sanity
checks on the attribute, and fill in the php_gfxinfo structure.
2025-07-20 12:53:57 +02:00
Niels Dossche 3cb7d1bd8a Remove custom UTF-8 check function from ext/libxml
This was originally introduced as a workaround for a libxml2 bug [1].
This bug has been fixed for more than a decade [2], and we can use the
libxml2 API again. We bumped our version requirement for libxml2 beyond
that in 7.4 [3].

[1] 7e53511ec8
[2] https://github.com/GNOME/libxml2/commit/3ffe90ea1cbd4fd8eb2eb162d7940a445f1455d6
[3] https://github.com/php/php-src/commit/74235ca5f3fae3325175cf0e68cd7e28c86e1378

Closes GH-18706.
2025-05-30 10:40:23 +02:00
Niels Dossche efaae93e48 Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-18597: Heap-buffer-overflow in zend_alloc.c when assigning string with UTF-8 bytes
2025-05-20 21:32:27 +02:00
Niels Dossche 40e667280b Fix GH-18597: Heap-buffer-overflow in zend_alloc.c when assigning string with UTF-8 bytes
xmlSave() also can flush in some cases. When the encoding is not
available this can fail for short inputs, resulting in an empty string
which is interned but then wrongly tagged by RETURN_NEW_STR.
Fix this by checking the error condition and switching to RETURN_STR for
defense-in-depth.

This issue also exists on 8.3, but does not crash; however, due to the
different API usage internally I cannot easily fix it on 8.3. There it
gives a partial output.

Closes GH-18606.
2025-05-20 21:32:17 +02:00
Gina Peter Banyard 3932d9b660 ext/libxml: Get rid of useless php_libxml_func_handler abstraction 2025-04-26 13:57:17 +01:00
Gina Peter Banyard dc036016a3 ext/libxml: Minor code nits 2025-04-26 13:57:17 +01:00
Gina Peter Banyard c5aa03c8b9 ext/libxml: Use bool type instead of int type 2025-04-26 13:57:17 +01:00
Gina Peter Banyard 1f1cd5c4bc ext/libxml: Add some const qualifiers 2025-04-26 13:57:17 +01:00
Gina Peter Banyard e59c7f887b ext/libxml: Reduce scope of variables 2025-04-26 13:57:17 +01:00
Gina Peter Banyard 213949dc34 Merge branch 'PHP-8.4'
* PHP-8.4:
  ext/libxml: Fixed custom external entity loader returning an invalid resource leading to a confusing TypeError message
2025-04-07 13:01:52 +01:00
Gina Peter Banyard 1e9e397122 Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  ext/libxml: Fixed custom external entity loader returning an invalid resource leading to a confusing TypeError message
2025-04-07 12:59:57 +01:00
Gina Peter Banyard 61f704f269 ext/libxml: Fixed custom external entity loader returning an invalid resource leading to a confusing TypeError message
Closes GH-18096
2025-04-07 12:58:52 +01:00
Jakub Zelenka acf2f4988a Merge branch 'PHP-8.2' into PHP-8.3 2025-03-11 22:09:00 +01:00