Skip to content
Closed
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
18 changes: 6 additions & 12 deletions sapi/cli/php_cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,11 +488,7 @@ static void php_cli_usage(char *argv0)
" %s [options] -- [args...]\n"
" %s [options] -a\n"
"\n"
#if (defined(HAVE_LIBREADLINE) || defined(HAVE_LIBEDIT)) && !defined(COMPILE_DL_READLINE)
" -a Run as interactive shell\n"
#else
" -a Run interactively\n"
#endif
" -a Run as interactive shell (requires readline extension)\n"
" -c <path>|<file> Look for php.ini file in this directory\n"
" -n No configuration (ini) files will be used\n"
" -d foo[=bar] Define INI entry foo with value 'bar'\n"
Expand Down Expand Up @@ -694,6 +690,10 @@ static int do_cli(int argc, char **argv) /* {{{ */
switch (c) {

case 'a': /* interactive mode */
if (!cli_shell_callbacks.cli_shell_run) {
param_error = "Interactive shell (-a) requires the readline extension.\n";
break;
}
if (!interactive) {
if (behavior != PHP_MODE_STANDARD) {
param_error = param_mode_conflict;
Expand Down Expand Up @@ -874,13 +874,7 @@ static int do_cli(int argc, char **argv) /* {{{ */
#endif

if (interactive) {
if (cli_shell_callbacks.cli_shell_run) {
printf("Interactive shell\n\n");
} else {
printf("Interactive mode enabled\n\n");
/* Treat as non-interactive apart from the stdin input */
interactive = false;
}
printf("Interactive shell\n\n");
fflush(stdout);
}

Expand Down
2 changes: 2 additions & 0 deletions sapi/cli/tests/009.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
--TEST--
using invalid combinations of cmdline options
--EXTENSIONS--
readline
--SKIPIF--
<?php include "skipif.inc"; ?>
--FILE--
Expand Down
2 changes: 2 additions & 0 deletions sapi/cli/tests/012-2.phpt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
--TEST--
more invalid arguments and error messages
--EXTENSIONS--
readline
--SKIPIF--
<?php include "skipif.inc"; ?>
--FILE--
Expand Down