[php-src] master: Merge branch 'PHP-8.5'

David Carlier <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: David Carlier (devnexen)
Date: 2026-07-06T13:57:45+01:00

Commit: https://github.com/php/php-src/commit/1a7f3c00978a563f20882b44487658a80878d868
Raw diff: https://github.com/php/php-src/commit/1a7f3c00978a563f20882b44487658a80878d868.diff

Merge branch 'PHP-8.5'

* PHP-8.5:
  ext/dom: fix GH-22570 new test

Changed paths:
  M  ext/dom/tests/modern/xml/gh22570.phpt


Diff:

diff --git a/ext/dom/tests/modern/xml/gh22570.phpt b/ext/dom/tests/modern/xml/gh22570.phpt
index af78acf00dfa..3d648aac5e4d 100644
--- a/ext/dom/tests/modern/xml/gh22570.phpt
+++ b/ext/dom/tests/modern/xml/gh22570.phpt
@@ -15,13 +15,15 @@ if (getenv('SKIP_ASAN')) {
 zend.max_allowed_stack_size=512K
 --FILE--
 <?php
-// Build via the DOM API, not the parser: libxml caps parse depth even with
-// LIBXML_PARSEHUGE on some platforms; the serializer recursion is the bug.
+// Build bottom-up so the insertion cycle-check stays O(1); top-down is O(n^2).
 $doc = Dom\XMLDocument::createEmpty();
-$node = $doc->appendChild($doc->createElement('root'));
+$node = $doc->createElement('a');
 for ($i = 0; $i < 100000; $i++) {
-    $node = $node->appendChild($doc->createElement('a'));
+    $parent = $doc->createElement('a');
+    $parent->appendChild($node);
+    $node = $parent;
 }
+$doc->appendChild($node);
 
 try {
     $doc->saveXml();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.