Skip to content

Commit 4adfa50

Browse files
committed
Declare ext/readline constants in stubs
1 parent eff9aed commit 4adfa50

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

ext/readline/readline.stub.php

Lines changed: 6 additions & 0 deletions
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

Lines changed: 6 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ext/readline/readline_cli.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@
7070

7171
#define DEFAULT_PROMPT "\\b \\> "
7272

73+
#if HAVE_LIBEDIT
74+
#define READLINE_LIB "libedit"
75+
#else
76+
#define READLINE_LIB "readline"
77+
#endif
78+
7379
ZEND_DECLARE_MODULE_GLOBALS(cli_readline)
7480

7581
static char php_last_char = '\0';
@@ -771,11 +777,7 @@ PHP_MINIT_FUNCTION(cli_readline)
771777
ZEND_INIT_MODULE_GLOBALS(cli_readline, cli_readline_init_globals, NULL);
772778
REGISTER_INI_ENTRIES();
773779

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
780+
register_readline_symbols(module_number);
779781

780782
GET_SHELL_CB(cb);
781783
if (cb) {

0 commit comments

Comments
 (0)