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.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
index 92f1f64bf4..5d789d2626 100644
--- a/sapi/cli/php_cli.c
+++ b/sapi/cli/php_cli.c
@@ -1018,16 +1018,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;