[php-src] master: Merge branch 'PHP-8.6'
| From: | ndossche | Date: | Thu, 22 Oct 2026 14:37:46 +0000 |
| Subject: | [php-src] master: Merge branch 'PHP-8.6' | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-142582@lists.php.net to get a copy of this message | ||
Author: ndossche (ndossche)
Date: 2026-10-22T16:37:34+02:00
Commit: https://github.com/php/php-src/commit/a2e4d85bf31e4233b680ec8274282d2d5a27ad49
Raw diff: https://github.com/php/php-src/commit/a2e4d85bf31e4233b680ec8274282d2d5a27ad49.diff
Merge branch 'PHP-8.6'
* PHP-8.6:
Fix GH-24508: HTTP wrapper leaks dechunk filter when header parsing fails
Changed paths:
A ext/standard/tests/http/gh24508.phpt
M ext/standard/http_fopen_wrapper.c
Diff:
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 1ca79b172259..2eadc006a29e 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -1264,6 +1264,8 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper,
if (stream->writepos > stream->readpos) {
php_stream_notify_progress_increment(context, stream->writepos - stream->readpos, 0);
}
+ } else if (header_info.transfer_encoding) {
+ php_stream_filter_free(header_info.transfer_encoding);
}
return stream;
diff --git a/ext/standard/tests/http/gh24508.phpt b/ext/standard/tests/http/gh24508.phpt
new file mode 100644
index 000000000000..33f31f474746
--- /dev/null
+++ b/ext/standard/tests/http/gh24508.phpt
@@ -0,0 +1,20 @@
+--TEST--
+GH-24508 (HTTP wrapper leaks the dechunk filter when header parsing fails after Transfer-Encoding)
+--INI--
+allow_url_fopen=1
+--SKIPIF--
+<?php require 'server.inc'; http_server_skipif(); ?>
+--FILE--
+<?php
+require 'server.inc';
+
+['pid' => $pid, 'uri' => $uri] = http_server([
+ "data://text/plain,HTTP/1.1 200 OK\r\nTransfer-Encoding:
chunked\r\nBrokenHeaderNoColon\r\n\r\n",
+]);
+
+var_dump(@file_get_contents($uri));
+
+http_server_kill($pid);
+?>
+--EXPECT--
+bool(false)