php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74489 readline() immediately returns false in interactive console mode
Submitted: 2017-04-22 15:56 UTC Modified: -
From: webmaster_20170422 at cubiclesoft dot com Assigned:
Status: Closed Package: Readline related
PHP Version: 7.1.4 OS: Windows
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: webmaster_20170422 at cubiclesoft dot com
New email:
PHP Version: OS:

 

 [2017-04-22 15:56 UTC] webmaster_20170422 at cubiclesoft dot com
Description:
------------
As of PHP 7.1, the readline extension is compiled into PHP for Windows.  Unfortunately, calling readline() with no parameters immediately returns false.  No PHP notices, warnings, or errors are emitted.

I'm using Windows 10, PHP 7.1.4 (from windows.php.net), and a plain ol' Command Prompt (not elevated).

'php -i' shows:

readline

Readline Support => enabled
Readline library => WinEditLine


Looking at the source code, it looks like WinEditLine expects a non-null value to be passed into readline().  Passing an empty string appears to work (readline("")) but the PHP documentation says the parameter is optional.

Test script:
---------------
<?php
var_dump(readline());
?>

Expected result:
----------------
Wait for user input and dump the string when the user presses Enter.

Actual result:
--------------
readline() with no parameters immediately returns a value of false.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-22 16:35 UTC] ab@php.net
Automatic comment on behalf of ab
Revision: http://git.php.net/?p=php-src.git;a=commit;h=000fe3aacce427eba082f12610b3b50f025b5e6a
Log: Fixed bug #74489 readline() immediately returns false in interactive console mode
 [2017-04-22 16:35 UTC] ab@php.net
-Status: Open +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Nov 13 04:01:31 2024 UTC