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

From: Date: Sat, 07 Nov 2026 19:10:37 +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-143408@lists.php.net to get a copy of this message
Author: Weilin Du (LamentXU123) Date: 2026-11-08T02:49:27+08:00 Commit: https://github.com/php/php-src/commit/532fcd118ceda1a2ea8fb77bfef51d4622131e38 Raw diff: https://github.com/php/php-src/commit/532fcd118ceda1a2ea8fb77bfef51d4622131e38.diff Merge branch 'PHP-8.4' into PHP-8.5 * PHP-8.4: ext/readline: Fix non-ASCII pending input in readline_info() (#25285) Changed paths: A ext/readline/tests/readline_info_pending_input.phpt M NEWS M ext/readline/readline.c Diff: diff --git a/NEWS b/NEWS index 7ee1d636120d..0d764ac46269 100644 --- a/NEWS +++ b/NEWS @@ -31,6 +31,10 @@ PHP NEWS . Fixed bug GH-25267 (NULL dereference in to_xml_any() with integer key). (lazerg) +- Readline: + . Fixed incorrect handling of non-ASCII pending_input bytes in readline_info(), + which could cause readline() to return false prematurely. (Weilin Du) + - Streams: . Fixed bug GH-22063 (Stream filter chain UAF on self-removal during callback). (Ilia Alshanetsky) diff --git a/ext/readline/readline.c b/ext/readline/readline.c index f9287af2eff6..cb1a6d948ad8 100644 --- a/ext/readline/readline.c +++ b/ext/readline/readline.c @@ -229,7 +229,7 @@ PHP_FUNCTION(readline_info) if (!try_convert_to_string(value)) { RETURN_THROWS(); } - rl_pending_input = Z_STRVAL_P(value)[0]; + rl_pending_input = (unsigned char)Z_STRVAL_P(value)[0]; } RETVAL_LONG(oldval); } else if (zend_string_equals_literal_ci(what, "prompt")) { diff --git a/ext/readline/tests/readline_info_pending_input.phpt b/ext/readline/tests/readline_info_pending_input.phpt new file mode 100644 index 000000000000..dd16bd0d5527 --- /dev/null +++ b/ext/readline/tests/readline_info_pending_input.phpt @@ -0,0 +1,28 @@ +--TEST-- +readline_info(): pending_input supports non-ASCII bytes +--EXTENSIONS-- +readline +--SKIPIF-- +<?php +if (READLINE_LIB !== 'readline') die('skip readline only'); +?> +--FILE-- +<?php +readline_info('pending_input', ''); +foreach (["\x7f", "\x80", "\xfe", "\xfftail", ''] as $value) { + $old = readline_info('pending_input', $value); + $current = readline_info('pending_input'); + $info = readline_info(); + printf("old=%d current=%d info=%d\n", + $old, + $current, + $info['pending_input'] + ); +} +?> +--EXPECT-- +old=0 current=127 info=127 +old=127 current=128 info=128 +old=128 current=254 info=254 +old=254 current=255 info=255 +old=255 current=0 info=0

« previous php.cvs (#143408) next »