diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2014-04-13 00:27:46 +0200 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2014-04-13 00:27:46 +0200 |
commit | 3db29ee43960a4e164244a55b0e2a4b23a112e49 (patch) | |
tree | bced3b5e38fe72a6a308e93f57602eb148ee93f3 /phpdbg.c | |
parent | 86a77317630255a254888de4437a8b060efdb863 (diff) | |
download | php-git-3db29ee43960a4e164244a55b0e2a4b23a112e49.tar.gz |
Added support for command line arg passing
"phpdbg -- arg" in shell
"run arg" in phpdbg prompt
Diffstat (limited to 'phpdbg.c')
-rw-r--r-- | phpdbg.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -1139,8 +1139,16 @@ phpdbg_main: phpdbg->ini_entries = ini_entries; if (phpdbg->startup(phpdbg) == SUCCESS) { - php_request_startup(TSRMLS_C); + int i; + SG(request_info).argc = argc - php_optind + 1; + SG(request_info).argv = emalloc(SG(request_info).argc * sizeof(char *)); + for (i = SG(request_info).argc; --i;) { + SG(request_info).argv[i] = estrdup(argv[php_optind - 1 + i]); + } + SG(request_info).argv[php_optind - 1] = exec?exec:""; + php_request_startup(TSRMLS_C); + /* do not install sigint handlers for remote consoles */ /* sending SIGINT then provides a decent way of shutting down the server */ #ifdef ZEND_SIGNALS @@ -1289,6 +1297,12 @@ phpdbg_out: } #endif + /* free argv */ + for (i = SG(request_info).argc; --i;) { + efree(SG(request_info).argv[i]); + } + efree(SG(request_info).argv); + #ifndef ZTS /* force cleanup of auto and core globals */ zend_hash_clean(CG(auto_globals)); |