Bug #79648 [Com]: Control + Arrows not working in Interactive PHP `php -a`
| From: | vike2000 at gmail dot com | Date: | Fri, 25 Jun 2021 16:10:26 +0000 |
| Subject: | Bug #79648 [Com]: Control + Arrows not working in Interactive PHP `php -a` | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234632@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79648&edit=1
ID: 79648
Comment by: vike2000 at gmail dot com
Reported by: d28b312d at opayq dot com
Summary: Control + Arrows not working in Interactive PHP `php
-a`
Status: Open
Type: Bug
Package: Readline related
Operating System: Windows 10 + Cygwin
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
I've been fighting a similar issue, though in the context of using a Dockerfile w/ "FROM
php:8.0-apache".
I generally prefer GNU Readline and on my host macOS-installation
php -a (installed w/
MacPorts port install php80 +readline) works fine with my binds in
~/.inputrc.
I don't think it's feasible to fork (and maintain) my own version of the Dockerfile, as
suggested in the two issues linked via https://github.com/docker-library/php/issues/717#issuecomment-421433322
I tried hacking-in docker-php-ext-install readline (via apt-get -y install
libreadline-dev, patching docker-php-ext-configure to be able to move running
phpize before removing a global test "$PHP_LIBEDIT" = "no"
&& PHP_LIBEDIT=yes (like hardcoded it's PHP_LIBEDIT=yes) and a
similarly global $as_echo "#define HAVE_LIBEDIT 1" >>confdefs.h in
./configure, and _then_ run docker-php-ext-configure).
I gave up when I found #define HAVE_LIBEDIT 1 in
/usr/local/include/php/main/php_config.h (ie asserting the php in Dockerfile w/
"FROM php:8.0-apache" is already built w/ editline?) which is included in the
readline.c.
Sorry I can't come with any more clear conclusion.
Thanks to anyone who look into this. Not to be rude or whine but I guess most people accept bad
REPL-editing?
Cheerio,
vike
(PS. I'm really trying to get eg bind "^W" ⦠in
~/.editrc working in Laravel ./artisan tinker which uses PsySH.)
Previous Comments:
------------------------------------------------------------------------
[2020-05-28 17:11:11] cmb@php.net
> The Cygwin PHP version is compiled with libedit [â¦]
Why? Did you ask the maintainers?
------------------------------------------------------------------------
[2020-05-28 16:21:39] d28b312d at opayq dot com
Description:
------------
The Cygwin PHP version is compiled with libedit which in itself isn't bad but it
seems on Cygwin it's outputting symbols such as ;5C and ;5D instead
of moving the cursor.
I have a valid inputrc file (used by bash for readline) and that works fine so for bash this is all
working.
I tried creating an editrc file ~/.editrc and it seems PHP doesn't load this, nor
does it obey the EDITRC env var either.
bind "\e[1;5D" vi-prev-word
bind "\e[1;5C" vi-next-word
My TERM Is 'xterm-256color' and this happens on any terminal (mintty or cmd).
Expected result:
----------------
Control + Arrows to work
Actual result:
--------------
/c/src/somesource (master) [0] $ php -a
Interactive shell
php > ;5D;5C;5D;5C
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79648&edit=1