go to bug id or search bugs for
As of PHP 7.1, the readline extension is compiled into PHP for Windows. Unfortunately, calling readline() results in the keyboard caret moving to the beginning of the line and clears any output on the line when the first key is pressed on the keyboard. For example, running the test script on Ubuntu Linux via a SSH terminal session (PHP run from Bash) works as expected (the caret is not moved nor the start of the line changed).
This behavior is most likely a bug in the upstream WinEditLine library. Documenting it here in bugs.php.net so the author of that library and the larger PHP community are aware of the issue.
This bug may be related to PHP Bug #74489, which describes a similar problem with WinEditLine's readline() most likely not accepting a null value for the prompt parameter.
Keyboard caret positioning information is available via the Windows Console API GetConsoleScreenBufferInfo().
echo "Name: ";
Similar behavior to *NIXes. The "Name: " string output to the terminal via echo and the keyboard caret correctly appears at the end of the string.
The "Name: " string appears but the keyboard caret is placed at the start of the line. The first keypress results in the displayed text being removed.
Add a Patch
Add a Pull Request
These issues are fixed with the upgraded WinEditline library, which is going to be included in the next regular 7.1 release. Please check latest 7.1 or master snapshots.