Commit a93d24cafa7 for php

commit a93d24cafa7c0bd596f7d6f9ea49f21de9ae6615
Author: Weilin Du <weilindu@php.net>
Date:   Sun Nov 8 02:45:35 2026 +0800

    ext/readline: Fix non-ASCII pending input in readline_info() (#25285)

    In some platform char is signed.
    Setting pending_input to a non-ASCII byte returns a negative value.

diff --git a/NEWS b/NEWS
index 2c23cc8aa95..ee8ab9f3529 100644
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,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 f9287af2eff..cb1a6d948ad 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 00000000000..dd16bd0d552
--- /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