Bug #80062 [NEW]: STDIN not support Chinese in CLI mode

From: Date: Sat, 05 Sep 2020 05:27:54 +0000
Subject: Bug #80062 [NEW]: STDIN not support Chinese in CLI mode
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-228892@lists.php.net to get a copy of this message
From: tsxgt at 163 dot com Operating system: Windows PHP version: 7.4.10 Package: Streams related Bug Type: Bug Bug description:STDIN not support Chinese in CLI mode Description: ------------ Windows system, run a php file with chinese character in PHP CLI mode, it return s unexpected value PHP 5.6.40 is ok PHP 7.0.33 is ok PHP >= 7.1.33 is bad Test script: --------------- <?php while (1) { $s = fgets(STDIN); echo var_dump($s); echo bin2hex($s); echo "\r\n"; } Expected result: ---------------- aaa string(5) "aaa " 6161610d0a 你好 string(6) "你好 " c4e3bac30d0a Actual result: -------------- aaa string(5) "aaa " 6161610d0a 你好 string(4) "\000\000 " 00000d0a -- Edit bug report at https://bugs.php.net/bug.php?id=80062&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80062&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80062&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80062&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80062&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80062&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80062&r=support Expected behavior: https://bugs.php.net/fix.php?id=80062&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80062&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80062&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80062&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80062&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80062&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80062&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80062&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80062&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80062&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80062&r=mysqlcfg

« previous php.bugs (#228892) next »