Commit 0a11544b158 for php

commit 0a11544b158c2e43e6432e7fadf3cea0a81269e9
Author: Jorg Sowa <jorg.sowa@gmail.com>
Date:   Mon Nov 16 22:40:16 2026 +0100

    ext/standard: Fix memory leak in get_meta_tags() on tag opened while expecting attribute value (GH-25479)

    Closes GH-25479

diff --git a/NEWS b/NEWS
index d98e18da8d4..84e8fdd0473 100644
--- a/NEWS
+++ b/NEWS
@@ -442,6 +442,8 @@ PHP                                                                        NEWS
     (Marti2203)
   . Fixed unserialize() of enums sharing its state with the unserialize()
     calls made by autoloaders. (nicolas-grekas)
+  . Fixed memory leak in get_meta_tags() when a tag opens while an attribute
+    value is expected. (Jorg Sowa)

 - Streams:
   . Fixed bug GH-22063 (Stream filter chain UAF on self-removal during
diff --git a/ext/standard/file.c b/ext/standard/file.c
index 412af159f19..eab4aa7f4b7 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -348,13 +348,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 00000000000..01f8e425367
--- /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"
+}