Bug #73292 [NEW]: readline_info returns empty/old line_buffer info
| From: | me at xbug dot de | Date: | Tue, 11 Oct 2016 15:03:37 +0000 |
| Subject: | Bug #73292 [NEW]: readline_info returns empty/old line_buffer info | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204602@lists.php.net to get a copy of this message | ||
From: me at xbug dot de
Operating system: Debian
PHP version: 5.6.26
Package: Readline related
Bug Type: Bug
Bug description:readline_info returns empty/old line_buffer info
Description:
------------
Under php5.4 (ubuntu 14.04) the function readline_info returned the
correct values. But since (possible 5.5) php5.6 (debian jessie) it
returns empty and sometimes old values.
I've tested it also under php7.0 (Mint) and the behaviour is the same as
in php5.6.
Test script:
---------------
<?php
readline_completion_function(
function ($input) {
$info = readline_info();
$text = substr($info['line_buffer'], 0, $info['end']);
var_dump($info);
if ($info['point'] !== $info['end']) {
return [];
}
// task name?
if (false === strpos($text, ' ') || !$text) {
return ['one', 'three'];
}
// This is never called since php 5.6
$cmd = substr($text, 0, strpos($text, ' '));
if ($cmd === 'one') {
return ['two'];
} elseif ($cmd === 'three') {
return ['four'];
}
return [];
}
);
while (true) {
readline('cmd: ');
}
Expected result:
----------------
$ php readline.php
cmd: onearray(6) {
["line_buffer"]=>
string(3) "one"
["point"]=>
int(3)
["end"]=>
int(3)
["library_version"]=>
string(16) "EditLine wrapper"
["readline_name"]=>
string(0) ""
["attempted_completion_over"]=>
int(0)
}
Actual result:
--------------
$ php readline.php
cmd: onearray(6) {
["line_buffer"]=>
string(0) ""
["point"]=>
int(3)
["end"]=>
int(3)
["library_version"]=>
string(16) "EditLine wrapper"
["readline_name"]=>
string(0) ""
["attempted_completion_over"]=>
int(0)
}
--
Edit bug report at https://bugs.php.net/bug.php?id=73292&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73292&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73292&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73292&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73292&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73292&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73292&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73292&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73292&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73292&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73292&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73292&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73292&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73292&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73292&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73292&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73292&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73292&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73292&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73292&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73292&r=mysqlcfg