Skip to content

Commit c854816

Browse files
authored
Declare ext/readline constants in stubs (php#9110)
1 parent a98560a commit c854816

File tree

5 files changed

+21
-7
lines changed

5 files changed

+21
-7
lines changed

ext/readline/php_readline.h

+6
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,12 @@
1717
#ifndef PHP_READLINE_H
1818
#define PHP_READLINE_H
1919

20+
#if HAVE_LIBEDIT
21+
#define READLINE_LIB "libedit"
22+
#else
23+
#define READLINE_LIB "readline"
24+
#endif
25+
2026
#if HAVE_LIBREADLINE || HAVE_LIBEDIT
2127

2228
extern zend_module_entry readline_module_entry;

ext/readline/readline.c

+3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ PHP_MINIT_FUNCTION(readline)
8282
#if HAVE_RL_CALLBACK_READ_CHAR
8383
ZVAL_UNDEF(&_prepped_callback);
8484
#endif
85+
86+
register_readline_symbols(module_number);
87+
8588
return PHP_MINIT(cli_readline)(INIT_FUNC_ARGS_PASSTHRU);
8689
}
8790

ext/readline/readline.stub.php

+6
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
/** @generate-class-entries */
44

5+
/**
6+
* @var string
7+
* @cvalue READLINE_LIB
8+
*/
9+
const READLINE_LIB = UNKNOWN;
10+
511
function readline(?string $prompt = null): string|false {}
612

713
/** @param int|string|bool|null $value */

ext/readline/readline_arginfo.h

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/readline/readline_cli.c

-6
Original file line numberDiff line numberDiff line change
@@ -771,12 +771,6 @@ PHP_MINIT_FUNCTION(cli_readline)
771771
ZEND_INIT_MODULE_GLOBALS(cli_readline, cli_readline_init_globals, NULL);
772772
REGISTER_INI_ENTRIES();
773773

774-
#if HAVE_LIBEDIT
775-
REGISTER_STRING_CONSTANT("READLINE_LIB", "libedit", CONST_CS|CONST_PERSISTENT);
776-
#else
777-
REGISTER_STRING_CONSTANT("READLINE_LIB", "readline", CONST_CS|CONST_PERSISTENT);
778-
#endif
779-
780774
GET_SHELL_CB(cb);
781775
if (cb) {
782776
cb->cli_shell_write = readline_shell_write;

0 commit comments

Comments
 (0)