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

From: Date: Fri, 13 Nov 2026 06:15:31 +0000
Subject: [php-src] master: Merge branch 'PHP-8.6'
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143676@lists.php.net to get a copy of this message
Author: David Carlier (devnexen) Date: 2026-11-13T06:13:55Z Commit: https://github.com/php/php-src/commit/4ef7b44ebb43a87d062ff47374124e51613c4526 Raw diff: https://github.com/php/php-src/commit/4ef7b44ebb43a87d062ff47374124e51613c4526.diff Merge branch 'PHP-8.6' * PHP-8.6: Fix GH-25434: C14NFile() skips namespace relinking on success Changed paths: A ext/dom/tests/modern/xml/gh25434.phpt M ext/dom/node.c Diff: diff --git a/ext/dom/node.c b/ext/dom/node.c index 88c058a6ac51..69d7d5d258db 100644 --- a/ext/dom/node.c +++ b/ext/dom/node.c @@ -2344,7 +2344,11 @@ static void dom_canonicalization(INTERNAL_FUNCTION_PARAMETERS, int mode) /* {{{ bytes = xmlOutputBufferClose(buf); if (mode == 1 && (ret >= 0)) { - RETURN_LONG(bytes); + if (bytes < 0) { + RETVAL_FALSE; + } else { + RETVAL_LONG(bytes); + } } } diff --git a/ext/dom/tests/modern/xml/gh25434.phpt b/ext/dom/tests/modern/xml/gh25434.phpt new file mode 100644 index 000000000000..22d8e8b3b79a --- /dev/null +++ b/ext/dom/tests/modern/xml/gh25434.phpt @@ -0,0 +1,22 @@ +--TEST-- +GH-25434 (C14NFile() on a Dom\XMLDocument leaves the document changed and leaks memory) +--CREDITS-- +Wonseok Oh (marinelay) +--EXTENSIONS-- +dom +--FILE-- +<?php +$doc = Dom\XMLDocument::createFromString('<root xmlns:p="urn:p"><p:a p:x="1"/></root>'); +var_dump($doc->C14NFile(__DIR__ . '/gh25434.xml')); +echo file_get_contents(__DIR__ . '/gh25434.xml'), "\n"; +echo $doc->saveXml(), "\n"; +?> +--CLEAN-- +<?php +@unlink(__DIR__ . '/gh25434.xml'); +?> +--EXPECT-- +int(48) +<root xmlns:p="urn:p"><p:a p:x="1"></p:a></root> +<?xml version="1.0" encoding="UTF-8"?> +<root xmlns:p="urn:p"><p:a p:x="1"/></root>

« previous php.cvs (#143676) next »