summaryrefslogtreecommitdiff
path: root/sapi/cli/php_cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'sapi/cli/php_cli.c')
-rw-r--r--sapi/cli/php_cli.c46
1 files changed, 30 insertions, 16 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 3b2bed8538..09ce00f9e7 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -2,7 +2,7 @@
+----------------------------------------------------------------------+
| PHP Version 7 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2015 The PHP Group |
+ | Copyright (c) 1997-2016 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
@@ -103,7 +103,7 @@ PHPAPI extern char *php_ini_scanned_path;
PHPAPI extern char *php_ini_scanned_files;
#if defined(PHP_WIN32) && defined(ZTS)
-ZEND_TSRMLS_CACHE_DEFINE();
+ZEND_TSRMLS_CACHE_DEFINE()
#endif
#ifndef O_BINARY
@@ -304,7 +304,7 @@ static size_t sapi_cli_ub_write(const char *str, size_t str_length) /* {{{ */
if (cli_shell_callbacks.cli_shell_ub_write) {
size_t ub_wrote;
ub_wrote = cli_shell_callbacks.cli_shell_ub_write(str, str_length);
- if (ub_wrote > -1) {
+ if (ub_wrote != (size_t) -1) {
return ub_wrote;
}
}
@@ -517,7 +517,7 @@ static void php_cli_usage(char *argv0)
" -a Run interactively\n"
#endif
" -c <path>|<file> Look for php.ini file in this directory\n"
- " -n No php.ini file will be used\n"
+ " -n No configuration (ini) files will be used\n"
" -d foo[=bar] Define INI entry foo with value 'bar'\n"
" -e Generate extended information for debugger/profiler\n"
" -f <file> Parse and execute <file>.\n"
@@ -682,17 +682,28 @@ static int do_cli(int argc, char **argv) /* {{{ */
goto out;
case 'v': /* show php version & quit */
- php_printf("PHP %s (%s) (built: %s %s) %s\nCopyright (c) 1997-2015 The PHP Group\n%s",
+ php_printf("PHP %s (%s) (built: %s %s) ( %s)\nCopyright (c) 1997-2016 The PHP Group\n%s",
PHP_VERSION, cli_sapi_module.name, __DATE__, __TIME__,
-#if ZEND_DEBUG && defined(HAVE_GCOV)
- "(DEBUG GCOV)",
-#elif ZEND_DEBUG
- "(DEBUG)",
-#elif defined(HAVE_GCOV)
- "(GCOV)",
+#if ZTS
+ "ZTS "
#else
- "",
+ "NTS "
#endif
+#ifdef COMPILER
+ COMPILER
+ " "
+#endif
+#ifdef ARCHITECTURE
+ ARCHITECTURE
+ " "
+#endif
+#if ZEND_DEBUG
+ "DEBUG "
+#endif
+#ifdef HAVE_GCOV
+ "GCOV "
+#endif
+ ,
get_zend_version()
);
sapi_deactivate();
@@ -1015,16 +1026,15 @@ static int do_cli(int argc, char **argv) /* {{{ */
if (exec_begin && zend_eval_string_ex(exec_begin, NULL, "Command line begin code", 1) == FAILURE) {
exit_status=254;
}
- ZVAL_LONG(&argi, index);
- zend_hash_str_update(&EG(symbol_table), "argi", sizeof("argi")-1, &argi);
while (exit_status == SUCCESS && (input=php_stream_gets(s_in_process, NULL, 0)) != NULL) {
len = strlen(input);
while (len > 0 && len-- && (input[len]=='\n' || input[len]=='\r')) {
input[len] = '\0';
}
- ZVAL_STRINGL(&argn, input, len);
+ ZVAL_STRINGL(&argn, input, len + 1);
zend_hash_str_update(&EG(symbol_table), "argn", sizeof("argn")-1, &argn);
- Z_LVAL(argi) = ++index;
+ ZVAL_LONG(&argi, ++index);
+ zend_hash_str_update(&EG(symbol_table), "argi", sizeof("argi")-1, &argi);
if (exec_run) {
if (zend_eval_string_ex(exec_run, NULL, "Command line run code", 1) == FAILURE) {
exit_status=254;
@@ -1220,6 +1230,10 @@ int main(int argc, char *argv[])
ZEND_TSRMLS_CACHE_UPDATE();
#endif
+#ifdef ZEND_SIGNALS
+ zend_signal_startup();
+#endif
+
#ifdef PHP_WIN32
_fmode = _O_BINARY; /*sets default for file streams to binary */
setmode(_fileno(stdin), O_BINARY); /* make the stdio mode be binary */