We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 750074b + 1e6f8df commit 1a7f3c0Copy full SHA for 1a7f3c0
1 file changed
ext/dom/tests/modern/xml/gh22570.phpt
@@ -15,13 +15,15 @@ if (getenv('SKIP_ASAN')) {
15
zend.max_allowed_stack_size=512K
16
--FILE--
17
<?php
18
-// Build via the DOM API, not the parser: libxml caps parse depth even with
19
-// 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).
20
$doc = Dom\XMLDocument::createEmpty();
21
-$node = $doc->appendChild($doc->createElement('root'));
+$node = $doc->createElement('a');
22
for ($i = 0; $i < 100000; $i++) {
23
- $node = $node->appendChild($doc->createElement('a'));
+ $parent = $doc->createElement('a');
+ $parent->appendChild($node);
24
+ $node = $parent;
25
}
26
+$doc->appendChild($node);
27
28
try {
29
$doc->saveXml();
0 commit comments