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

From: Date: Wed, 07 Oct 2026 06:59:57 +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-142062@lists.php.net to get a copy of this message
Author: David Carlier (devnexen) Date: 2026-10-07T07:58:49+01:00 Commit: https://github.com/php/php-src/commit/89e957fd545b7be038e343896456514951f9449e Raw diff: https://github.com/php/php-src/commit/89e957fd545b7be038e343896456514951f9449e.diff Merge branch 'PHP-8.5' into PHP-8.6 Changed paths: A sapi/cli/tests/gh24139.phpt M main/php_ini.c Diff: diff --git a/main/php_ini.c b/main/php_ini.c index a3b33da65bab..524fc5f7a4a7 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -560,7 +560,13 @@ void php_init_config(void) fp = VCWD_FOPEN(php_ini_file_name, "r"); if (fp) { filename = expand_filepath(php_ini_file_name, NULL); - free_filename = true; + if (filename) { + free_filename = true; + } else { + /* Reject the file, like ZTS where VCWD_STAT() already fails */ + fclose(fp); + fp = NULL; + } } } } diff --git a/sapi/cli/tests/gh24139.phpt b/sapi/cli/tests/gh24139.phpt new file mode 100644 index 000000000000..503b853ecfd7 --- /dev/null +++ b/sapi/cli/tests/gh24139.phpt @@ -0,0 +1,30 @@ +--TEST-- +GH-24139 (NULL pointer dereference in php_ini.c when expand_filepath() fails) +--SKIPIF-- +<?php +include "skipif.inc"; +if (PHP_OS_FAMILY === "Windows") die("skip not for Windows"); +?> +--FILE-- +<?php +$ini_file = __DIR__ . "/gh24139.ini"; +file_put_contents($ini_file, "gh24139=ok\n"); + +$relative = str_repeat("./", intdiv(PHP_MAXPATHLEN - strlen(__DIR__), 2)) . "gh24139.ini"; + +$proc = proc_open( + [getenv("TEST_PHP_EXECUTABLE"), "-c", $relative, "-r", 'var_dump(get_cfg_var("gh24139"));'], + [1 => ["pipe", "w"]], + $pipes, + __DIR__ +); +echo stream_get_contents($pipes[1]); +var_dump(proc_close($proc)); +?> +--CLEAN-- +<?php +@unlink(__DIR__ . "/gh24139.ini"); +?> +--EXPECT-- +bool(false) +int(0)

« previous php.cvs (#142062) next »