Bug #74574 [Opn->Ver]: readline duplicates the input by twice
| From: | cmb@php.net | Date: | Fri, 27 Aug 2021 13:23:45 +0000 |
| Subject: | Bug #74574 [Opn->Ver]: readline duplicates the input by twice | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-236119@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=74574&edit=1
ID: 74574
Updated by: cmb@php.net
Reported by: cornelius dot howl at gmail dot com
Summary: readline duplicates the input by twice
-Status: Open
+Status: Verified
Type: Bug
Package: Readline related
Operating System: OSX
PHP Version: 7.1.4
Block user comment: N
Private report: N
New Comment:
I can confirm Peter's findings (PHP-7.4).
Previous Comments:
------------------------------------------------------------------------
[2019-02-10 21:17:26] petk@php.net
This happens due to different library usage.
When PHP is compiled with
./configure --with-libedit --without-readline (using Libedit
as a replacement for readline) only one foo is output.
When PHP is compiled with --configure --with-readline (using GNU readline library), two
foo strings are output.
------------------------------------------------------------------------
[2017-05-11 16:15:01] yoanlin93 at gmail dot com
After further investigation, I found the first "foo" was output by php, and the other one
was returned from readline().
This behavior is different from php 5.4~5.6
------------------------------------------------------------------------
[2017-05-11 16:11:44] cornelius dot howl at gmail dot com
Description:
------------
when piping string to the php executable, readline returns the duplicate input by twice.
Test script:
---------------
here is the simple script to reproduce this issue:
readline.php:
<?php echo readline(''); ?>
execute:
# echo foo | php readline.php
Expected result:
----------------
foo
Actual result:
--------------
foo
foo
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=74574&edit=1