Bug #74490 [Opn->Csd]: readline() moves the cursor to the beginning of the line

From: Date: Sun, 14 May 2017 00:35:17 +0000
Subject: Bug #74490 [Opn->Csd]: readline() moves the cursor to the beginning of the line
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209097@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74490&edit=1

 ID:                 74490
 Updated by:         ab@php.net
 Reported by:        webmaster_20170422 at cubiclesoft dot com
 Summary:            readline() moves the cursor to the beginning of the
                     line
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            Readline related
 Operating System:   Windows
 PHP Version:        7.1.4
-Assigned To:        
+Assigned To:        ab
 Block user comment: N
 Private report:     N

 New Comment:

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.

Thanks.


Previous Comments:
------------------------------------------------------------------------
[2017-04-22 16:26:50] webmaster_20170422 at cubiclesoft dot com

Description:
------------
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().

Test script:
---------------
<?php
echo "Name:  ";
readline("");
?>

Expected result:
----------------
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.

Actual result:
--------------
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.


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74490&edit=1


Thread (2 messages)

« previous php.bugs (#209097) next »