[php-src] PHP-8.6: Merge branch 'PHP-8.4' into PHP-8.5

From: Date: Mon, 16 Nov 2026 21:51:16 +0000
Subject: [php-src] PHP-8.6: Merge branch 'PHP-8.4' into PHP-8.5
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143752@lists.php.net to get a copy of this message
Author: Jorg Sowa (jorgsowa) Date: 2026-11-16T22:40:55+01:00 Commit: https://github.com/php/php-src/commit/c8ca69e6852267848eba21f94006b1b232cc1a01 Raw diff: https://github.com/php/php-src/commit/c8ca69e6852267848eba21f94006b1b232cc1a01.diff Merge branch 'PHP-8.4' into PHP-8.5 # Conflicts: # NEWS Changed paths: A ext/standard/tests/strings/get_meta_tags_open_tag_leak.phpt M NEWS M ext/standard/file.c Diff: diff --git a/NEWS b/NEWS index 24571d4b3aca..9960f664fb3e 100644 --- a/NEWS +++ b/NEWS @@ -120,6 +120,8 @@ PHP NEWS (Kévin Dunglas) . Fixed bug GH-24743 (var_export() ignores exceptions from lazy object initialization). (lazerg) + . Fixed memory leak in get_meta_tags() when a tag opens while an attribute + value is expected. (Jorg Sowa) - Streams: . Fixed in-place URL decoding of interned strings in the HTTP and FTP diff --git a/ext/standard/file.c b/ext/standard/file.c index 51258be9c736..f8a65fa77600 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -343,13 +343,10 @@ PHP_FUNCTION(get_meta_tags) } else { add_assoc_string(return_value, name, ""); } - - efree(name); - if (value) efree(value); - } else if (have_content) { - efree(value); } + if (name) efree(name); + if (value) efree(value); name = value = NULL; /* Reset all of our flags */ diff --git a/ext/standard/tests/strings/get_meta_tags_open_tag_leak.phpt b/ext/standard/tests/strings/get_meta_tags_open_tag_leak.phpt new file mode 100644 index 000000000000..01f8e4253670 --- /dev/null +++ b/ext/standard/tests/strings/get_meta_tags_open_tag_leak.phpt @@ -0,0 +1,25 @@ +--TEST-- +get_meta_tags() does not leak when a tag opens while an attribute value is expected +--FILE-- +<?php + +$filename = __DIR__."/get_meta_tags_open_tag_leak.html"; + +file_put_contents($filename, <<<HTML +<meta name="foo" content=<meta> +<meta content="bar" name=<meta> +<meta name="baz" content="qux"> +HTML); + +var_dump(get_meta_tags($filename)); + +?> +--CLEAN-- +<?php +@unlink(__DIR__."/get_meta_tags_open_tag_leak.html"); +?> +--EXPECT-- +array(1) { + ["baz"]=> + string(3) "qux" +}

« previous php.cvs (#143752) next »