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

From: Date: Mon, 16 Nov 2026 21:51:17 +0000
Subject: [php-src] master: Merge branch 'PHP-8.5' into PHP-8.6
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-143753@lists.php.net to get a copy of this message
Author: Jorg Sowa (jorgsowa) Date: 2026-11-16T22:41:05+01:00 Commit: https://github.com/php/php-src/commit/6e219ab381ad2753ab8ec93c5be4f1ccdc00b5f5 Raw diff: https://github.com/php/php-src/commit/6e219ab381ad2753ab8ec93c5be4f1ccdc00b5f5.diff Merge branch 'PHP-8.5' into PHP-8.6 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 2c19cee1f86e..b032c454417d 100644 --- a/NEWS +++ b/NEWS @@ -151,6 +151,8 @@ PHP NEWS an unknown transport. (Jorg Sowa) . 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 e64167df3283..e76310dd1332 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 (#143753) next »