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

From: Date: Sat, 19 Sep 2026 21:23:52 +0000
Subject: [php-src] PHP-8.5: Merge branch 'PHP-8.4' into PHP-8.5
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-141288@lists.php.net to get a copy of this message
Author: Ilia Alshanetsky (iliaal) Date: 2026-09-19T17:22:58-04:00 Commit: https://github.com/php/php-src/commit/6bad8fdeaa1d987c1b244952d1828be4a5eb126e Raw diff: https://github.com/php/php-src/commit/6bad8fdeaa1d987c1b244952d1828be4a5eb126e.diff Merge branch 'PHP-8.4' into PHP-8.5 * PHP-8.4: Fix heap over-read in cli_get_prompt() for empty cli.prompt Changed paths: M NEWS M ext/readline/readline_cli.c Diff: diff --git a/NEWS b/NEWS index ead9e3308b9a..0a8f3f02eb48 100644 --- a/NEWS +++ b/NEWS @@ -45,6 +45,10 @@ PHP NEWS - PGSQL: . Fixed pg_lo_write() rejecting data containing null bytes. (Ilia Alshanetsky) +- Readline: + . Fixed a heap over-read in the interactive shell prompt when cli.prompt is + set to an empty string. (Ilia Alshanetsky) + - SQLite: . Fixed a crash when SQLite3::close() is called from a userland callback. (Ilia Alshanetsky) diff --git a/ext/readline/readline_cli.c b/ext/readline/readline_cli.c index 985a797754d9..bf508a79a708 100644 --- a/ext/readline/readline_cli.c +++ b/ext/readline/readline_cli.c @@ -130,7 +130,7 @@ static zend_string *cli_get_prompt(char *block, char prompt) /* {{{ */ char *prompt_spec = CLIR_G(prompt) ? CLIR_G(prompt) : DEFAULT_PROMPT; bool unicode_warned = false; - do { + while (*prompt_spec) { if (*prompt_spec == '\\') { switch (prompt_spec[1]) { case '\\': @@ -198,9 +198,9 @@ static zend_string *cli_get_prompt(char *block, char prompt) /* {{{ */ smart_str_appendc(&retval, '?'); } } - } while (++prompt_spec && *prompt_spec); - smart_str_0(&retval); - return retval.s; + ++prompt_spec; + } + return smart_str_extract(&retval); } /* }}} */

« previous php.cvs (#141288) next »