Commit 6f91209260c for php.net
commit 6f91209260cca91191055e68491b8cafae1463d1
Merge: e027c66f1fa c6ad84fb9e5
Author: Ilija Tovilo <ilija.tovilo@me.com>
Date: Fri Feb 27 15:05:14 2026 +0100
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
Add RUN_RESOURCE_HEAVY_TESTS env var
diff --cc ext/dom/tests/parentnode_childnode_too_long_text.phpt
index 62edaebfe4a,00000000000..dee10566e26
mode 100644,000000..100644
--- a/ext/dom/tests/parentnode_childnode_too_long_text.phpt
+++ b/ext/dom/tests/parentnode_childnode_too_long_text.phpt
@@@ -1,80 -1,0 +1,81 @@@
+--TEST--
+Passing a too long string to ChildNode or ParentNode methods causes an exception
+--EXTENSIONS--
+dom
+--INI--
+memory_limit=-1
+--SKIPIF--
+<?php
++if (!getenv('RUN_RESOURCE_HEAVY_TESTS')) die('skip resource-heavy test');
+if (PHP_INT_SIZE !== 8) die('skip Only for 64-bit');
+if (getenv('SKIP_SLOW_TESTS')) die('skip slow test');
+// Copied from file_get_contents_file_put_contents_5gb.phpt
+function get_system_memory(): int|float|false
+{
+ if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+ // Windows-based memory check
+ @exec('wmic OS get FreePhysicalMemory', $output);
+ if (isset($output[1])) {
+ return ((int)trim($output[1])) * 1024;
+ }
+ } else {
+ // Unix/Linux-based memory check
+ $memInfo = @file_get_contents("/proc/meminfo");
+ if ($memInfo) {
+ preg_match('/MemFree:\s+(\d+) kB/', $memInfo, $matches);
+ return $matches[1] * 1024; // Convert to bytes
+ }
+ }
+ return false;
+}
+if (get_system_memory() < 4 * 1024 * 1024 * 1024) {
+ die('skip Reason: Insufficient RAM (less than 4GB)');
+}
+?>
+--FILE--
+<?php
+$dom = new DOMDocument;
+$element = $dom->appendChild($dom->createElement('root'));
+$str = str_repeat('X', 2**31 + 10);
+try {
+ $element->append('x', $str);
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $element->prepend('x', $str);
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $element->after('x', $str);
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $element->before('x', $str);
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $element->replaceWith('x', $str);
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $element->replaceChildren('x', $str);
+} catch (ValueError $e) {
+ echo $e->getMessage(), "\n";
+}
+var_dump($dom->childNodes->count());
+var_dump($element->childNodes->count());
+?>
+--EXPECT--
+DOMElement::append(): Argument #2 must be less than or equal to 2147483647 bytes long
+DOMElement::prepend(): Argument #2 must be less than or equal to 2147483647 bytes long
+DOMElement::after(): Argument #2 must be less than or equal to 2147483647 bytes long
+DOMElement::before(): Argument #2 must be less than or equal to 2147483647 bytes long
+DOMElement::replaceWith(): Argument #2 must be less than or equal to 2147483647 bytes long
+DOMElement::replaceChildren(): Argument #2 must be less than or equal to 2147483647 bytes long
+int(1)
+int(0)
diff --cc ext/xml/tests/bug81481.phpt
index 6bbbc03d61e,00000000000..ee37cacfa31
mode 100644,000000..100644
--- a/ext/xml/tests/bug81481.phpt
+++ b/ext/xml/tests/bug81481.phpt
@@@ -1,36 -1,0 +1,37 @@@
+--TEST--
+Bug #81481 (xml_get_current_byte_index limited to 32-bit numbers on 64-bit builds)
+--CREDITS--
+dev at b65sol dot com
+--EXTENSIONS--
+xml
+--INI--
+memory_limit=-1
+--SKIPIF--
+<?php
++if (!getenv('RUN_RESOURCE_HEAVY_TESTS')) die('skip resource-heavy test');
+require __DIR__ . '/libxml_expat_skipif.inc';
+skipif(want_expat: false);
+if (getenv("SKIP_SLOW_TESTS")) die("skip slow test");
+if (PHP_INT_SIZE != 8) die("skip 64-bit only");
+if (PHP_OS_FAMILY == 'Windows') die('skip not for Windows');
+?>
+--FILE--
+<?php
+$parser = xml_parser_create('UTF-8');
+xml_set_element_handler( $parser, 'startelement', null );
+
+$emptylong = str_repeat(' ', 1024*1024);
+xml_parse($parser, '<root><i></i><b/><ext>Hello</ext>', false);
+for($i = 0; $i < 2200; $i++) {
+ xml_parse($parser, $emptylong, false);
+}
+xml_parse($parser, '<ext></ext><ext></ext></root>', false);
+
+function startelement($parser, $name, $attribute) {
+ if ( $name == 'EXT' ) { echo "Byte Index:", xml_get_current_byte_index($parser), "\n"; }
+}
+?>
+--EXPECT--
+Byte Index:21
+Byte Index:2306867237
+Byte Index:2306867248