Skip to content

Declare ext/readline constants in stubs #9110

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

Merged
merged 1 commit into from
Jul 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ext/readline/php_readline.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@
#ifndef PHP_READLINE_H
#define PHP_READLINE_H

#if HAVE_LIBEDIT
#define READLINE_LIB "libedit"
#else
#define READLINE_LIB "readline"
#endif

#if HAVE_LIBREADLINE || HAVE_LIBEDIT

extern zend_module_entry readline_module_entry;
Expand Down
3 changes: 3 additions & 0 deletions ext/readline/readline.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ PHP_MINIT_FUNCTION(readline)
#if HAVE_RL_CALLBACK_READ_CHAR
ZVAL_UNDEF(&_prepped_callback);
#endif

register_readline_symbols(module_number);

return PHP_MINIT(cli_readline)(INIT_FUNC_ARGS_PASSTHRU);
}

Expand Down
6 changes: 6 additions & 0 deletions ext/readline/readline.stub.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

/** @generate-class-entries */

/**
* @var string
* @cvalue READLINE_LIB
*/
const READLINE_LIB = UNKNOWN;

function readline(?string $prompt = null): string|false {}

/** @param int|string|bool|null $value */
Expand Down
7 changes: 6 additions & 1 deletion ext/readline/readline_arginfo.h

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions ext/readline/readline_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -771,12 +771,6 @@ PHP_MINIT_FUNCTION(cli_readline)
ZEND_INIT_MODULE_GLOBALS(cli_readline, cli_readline_init_globals, NULL);
REGISTER_INI_ENTRIES();

#if HAVE_LIBEDIT
REGISTER_STRING_CONSTANT("READLINE_LIB", "libedit", CONST_CS|CONST_PERSISTENT);
#else
REGISTER_STRING_CONSTANT("READLINE_LIB", "readline", CONST_CS|CONST_PERSISTENT);
#endif

GET_SHELL_CB(cb);
if (cb) {
cb->cli_shell_write = readline_shell_write;
Expand Down