-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Allow overriding readline completion in auto_prepend_file
#5872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
auto_prepend_file
auto_prepend_file
1b35ba4
to
5706ed4
Compare
@cmb69 @nikic - I see you've contributed to readline, and it looks like readline hasn't been changed substantially since 2011 or so (e.g. 618b480 changed the handling of the readline callback) I'd consider the current behavior of readline in auto_prepend_file to be a bug (see PR description and https://externals.io/message/111073) What would you suggest for me to do to include changes to readline in php 8.0/8.1? |
This patch looks good to me; I suggest to merge it, if nobody objects. However, it seems to me that |
|
Correct Please not my note above about For some context: This indeed should only be used in CLI SAPI. Historically the code lived in |
Currently, it's possible to override `php -a`s completion functionality to provide an alternative to the C implementation, with `readline_completion_function()`. However, that surprisingly gets overridden when called from `auto_prepend_file`, because those scripts get run before the interactive shell is started. I believe that not overriding it would be more consistent with what happens when you override the completion function **after** the interactive shell. CLI is the only built-in API that uses this (See discussion in phpGH-5872). I believe MINIT and RINIT will only run once when invoked with `php -a`. Add documentation about the architecture of how php uses readline/libedit
5706ed4
to
0a2412b
Compare
Thanks for explanaining! :) |
Renamed to `php_readline_completion_cb and added a README with the information mentioned here. This will get merged if nobody objects. Missing information in the README could get amended in future PRs/commits. |
Merged and added a note to |
Currently, it's possible to override
php -a
s completionfunctionality to provide an alternative to the C implementation,
with
readline_completion_function()
.However, that surprisingly gets overridden when called from
auto_prepend_file
, because those scripts get run before the interactive shellis started. I believe that not overriding it would be more consistent
with what happens when you override the completion function after the
interactive shell.
CLI is the only built-in API that uses this.
I believe MINIT and RINIT will only run once when invoked with
php -a
.