File tree 4 files changed +16
-12
lines changed 4 files changed +16
-12
lines changed Original file line number Diff line number Diff line change @@ -277,6 +277,12 @@ PHP 8.1 UPGRADE NOTES
277
277
3. Changes in SAPI modules
278
278
========================================
279
279
280
+ - CLI:
281
+ . Using -a without the readline extension will now result in an error.
282
+ Previously, -a without readline had the same behavior as calling php without
283
+ any arguments, apart from printing an additional "Interactive mode enabled"
284
+ message. This mode was not, in fact, interactive.
285
+
280
286
========================================
281
287
4. Deprecated Functionality
282
288
========================================
Original file line number Diff line number Diff line change @@ -488,11 +488,7 @@ static void php_cli_usage(char *argv0)
488
488
" %s [options] -- [args...]\n"
489
489
" %s [options] -a\n"
490
490
"\n"
491
- #if (defined (HAVE_LIBREADLINE ) || defined (HAVE_LIBEDIT )) && !defined (COMPILE_DL_READLINE )
492
- " -a Run as interactive shell\n"
493
- #else
494
- " -a Run interactively\n"
495
- #endif
491
+ " -a Run as interactive shell (requires readline extension)\n"
496
492
" -c <path>|<file> Look for php.ini file in this directory\n"
497
493
" -n No configuration (ini) files will be used\n"
498
494
" -d foo[=bar] Define INI entry foo with value 'bar'\n"
@@ -694,6 +690,10 @@ static int do_cli(int argc, char **argv) /* {{{ */
694
690
switch (c ) {
695
691
696
692
case 'a' : /* interactive mode */
693
+ if (!cli_shell_callbacks .cli_shell_run ) {
694
+ param_error = "Interactive shell (-a) requires the readline extension.\n" ;
695
+ break ;
696
+ }
697
697
if (!interactive ) {
698
698
if (behavior != PHP_MODE_STANDARD ) {
699
699
param_error = param_mode_conflict ;
@@ -874,13 +874,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
874
874
#endif
875
875
876
876
if (interactive ) {
877
- if (cli_shell_callbacks .cli_shell_run ) {
878
- printf ("Interactive shell\n\n" );
879
- } else {
880
- printf ("Interactive mode enabled\n\n" );
881
- /* Treat as non-interactive apart from the stdin input */
882
- interactive = false;
883
- }
877
+ printf ("Interactive shell\n\n" );
884
878
fflush (stdout );
885
879
}
886
880
Original file line number Diff line number Diff line change 1
1
--TEST--
2
2
using invalid combinations of cmdline options
3
+ --EXTENSIONS--
4
+ readline
3
5
--SKIPIF--
4
6
<?php include "skipif.inc " ; ?>
5
7
--FILE--
Original file line number Diff line number Diff line change 1
1
--TEST--
2
2
more invalid arguments and error messages
3
+ --EXTENSIONS--
4
+ readline
3
5
--SKIPIF--
4
6
<?php include "skipif.inc " ; ?>
5
7
--FILE--
You can’t perform that action at this time.
0 commit comments