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

From: Date: Tue, 27 Oct 2026 17:53:59 +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-142838@lists.php.net to get a copy of this message
Author: Jakub Zelenka (bukka) Date: 2026-10-27T18:52:11+01:00 Commit: https://github.com/php/php-src/commit/97fe7d69f6ca62a747f16684c14ebcd8f3be7c6f Raw diff: https://github.com/php/php-src/commit/97fe7d69f6ca62a747f16684c14ebcd8f3be7c6f.diff Merge branch 'PHP-8.4' into PHP-8.5 * PHP-8.4: fpm: fix _GET_str memory leaks and test headers_only status path fpm: fix a use-after-free of scoreboard_p fpm: fix potential null dereference in fpm_status_export_to_zval() Changed paths: A sapi/fpm/tests/status-head.phpt M NEWS M sapi/fpm/fpm/fpm_status.c Diff: diff --git a/NEWS b/NEWS index 25f7f931555d..d6d453231178 100644 --- a/NEWS +++ b/NEWS @@ -66,6 +66,12 @@ PHP NEWS . Fixed bug GH-24046 (FPM worker stdio pipe fd closed twice when a child process outlives the worker, breaking a later worker's stdio). (Ian P. Christian, ndossche) + . Fixed memory leaks of the _GET string on the status page error and HEAD + request paths. (Marcel Hernandez) + . Fixed use-after-free of the scoreboard copy when logging invalid status + values. (Marcel Hernandez) + . Fixed null pointer dereference in fpm_get_status() when the scoreboard + copy fails. (Marcel Hernandez) - FTP: . Fix double free in ext/ftp data_accept() on accept failure. (alepacheco) diff --git a/sapi/fpm/fpm/fpm_status.c b/sapi/fpm/fpm/fpm_status.c index ff6ef68f3949..118be47bfeee 100644 --- a/sapi/fpm/fpm/fpm_status.c +++ b/sapi/fpm/fpm/fpm_status.c @@ -56,6 +56,9 @@ int fpm_status_export_to_zval(zval *status) int i; scoreboard_p = fpm_scoreboard_copy(NULL, 1); + if (!scoreboard_p) { + return -1; + } now_epoch = time(NULL); fpm_clock_get(&now); @@ -180,17 +183,19 @@ int fpm_status_handle_request(void) /* {{{ */ sapi_add_header_ex(ZEND_STRL("Expires: Thu, 01 Jan 1970 00:00:00 GMT"), 1, 1); sapi_add_header_ex(ZEND_STRL("Cache-Control: no-cache, no-store, must-revalidate, max-age=0"), 1, 1); PUTS("Internal error. Please review log file for errors."); + zend_string_release_ex(_GET_str, 0); return 1; } if (scoreboard_p->idle < 0 || scoreboard_p->active < 0) { - fpm_scoreboard_free_copy(scoreboard_p); zlog(ZLOG_ERROR, "[pool %s] invalid status values", scoreboard_p->pool); SG(sapi_headers).http_response_code = 500; sapi_add_header_ex(ZEND_STRL("Content-Type: text/plain"), 1, 1); sapi_add_header_ex(ZEND_STRL("Expires: Thu, 01 Jan 1970 00:00:00 GMT"), 1, 1); sapi_add_header_ex(ZEND_STRL("Cache-Control: no-cache, no-store, must-revalidate, max-age=0"), 1, 1); PUTS("Internal error. Please review log file for errors."); + zend_string_release_ex(_GET_str, 0); + fpm_scoreboard_free_copy(scoreboard_p); return 1; } @@ -201,6 +206,7 @@ int fpm_status_handle_request(void) /* {{{ */ /* handle HEAD */ if (SG(request_info).headers_only) { + zend_string_release_ex(_GET_str, 0); fpm_scoreboard_free_copy(scoreboard_p); return 1; } diff --git a/sapi/fpm/tests/status-head.phpt b/sapi/fpm/tests/status-head.phpt new file mode 100644 index 000000000000..a21fb7a7f1f8 --- /dev/null +++ b/sapi/fpm/tests/status-head.phpt @@ -0,0 +1,40 @@ +--TEST-- +FPM: Status HEAD request returns headers without body +--SKIPIF-- +<?php include "skipif.inc"; ?> +--FILE-- +<?php + +require_once "tester.inc"; + +$cfg = <<<EOT +[global] +error_log = {{FILE:LOG}} +[unconfined] +listen = {{ADDR}} +pm = static +pm.max_children = 1 +pm.status_path = /status +EOT; + +$tester = new FPM\Tester($cfg); +$tester->start(); +$tester->expectLogStartNotices(); +$tester->request()->expectEmptyBody(); + +$response = $tester->request(uri: '/status', method: 'HEAD'); +$response->expectEmptyBody(); + +$tester->terminate(); +$tester->expectLogTerminatingNotices(); +$tester->close(); + +?> +Done +--EXPECT-- +Done +--CLEAN-- +<?php +require_once "tester.inc"; +FPM\Tester::clean(); +?>

« previous php.cvs (#142838) next »