php-src/ext/readline
Tyson Andre 97f10fc341 Allow overriding completion in auto_prepend_file
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 GH-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

Closes GH-5872
2020-08-01 11:39:08 -04:00
..
tests Fix readline test after callback changes 2020-07-21 10:40:08 +02:00
config.m4 Normalize comments in *nix build system m4 files 2019-05-12 18:43:03 +02:00
config.w32 add readline_list_history with libedit >= 3.1 and mingweditline 2019-02-19 08:51:56 +01:00
CREDITS
php_readline.h Remove mention of PHP major version in Copyright headers 2019-09-25 14:51:43 +02:00
readline_arginfo.h Use ZPP callable check in readline extension 2020-07-21 00:52:50 +01:00
readline_cli.c Allow overriding completion in auto_prepend_file 2020-08-01 11:39:08 -04:00
readline_cli.h Allow overriding completion in auto_prepend_file 2020-08-01 11:39:08 -04:00
readline.c Allow overriding completion in auto_prepend_file 2020-08-01 11:39:08 -04:00
readline.stub.php Use ZPP callable check in readline extension 2020-07-21 00:52:50 +01:00
README.md Allow overriding completion in auto_prepend_file 2020-08-01 11:39:08 -04:00

readline

Provides generic line editing, history, and tokenization functions. See https://www.php.net/manual/en/book.readline.php

Implementation Details

C variables starting with rl_* are declared by the readline library (or are macros referring to variables from the libedit library). See http://web.mit.edu/gnu/doc/html/rlman_2.html

This should only be used in the CLI SAPI. Historically, the code lived in sapi/cli, but many distributions build readline as a shared extension. Therefore, that code was split into ext/readline so that this can dynamically be loaded. With other SAPIs, readline is/should be disabled.

readline_cli.c implements most of the interactive shell(php -a).