From: krakjoe Date: Mon, 2 Dec 2013 14:45:41 +0000 (+0000) Subject: added ability to override sapi name X-Git-Tag: php-5.6.0alpha1~110^2~30^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6e7c1ed0c8ad19cd76491943b6276b209d39dddc;p=php added ability to override sapi name --- diff --git a/Changelog.md b/Changelog.md index 8e817ca212..aed299cab1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,7 @@ Version 0.3.0 2013-00-00 ------------------------ 1. Added ability to disable an enable a single breakpoint +2. Added ability to override SAPI name Version 0.2.0 2013-11-31 ------------------------ diff --git a/phpdbg.c b/phpdbg.c index 602cc0bdda..bbe992c930 100644 --- a/phpdbg.c +++ b/phpdbg.c @@ -487,6 +487,7 @@ const opt_struct OPTIONS[] = { /* {{{ */ {'O', 1, "opline log"}, {'r', 0, "run"}, {'E', 0, "step-through-eval"}, + {'S', 1, "sapi-name"}, #ifndef _WIN32 {'l', 1, "listen"}, {'a', 1, "address-or-any"}, @@ -716,6 +717,7 @@ int main(int argc, char **argv) /* {{{ */ zend_bool remote = 0; int run = 0; int step = 0; + char *sapi_name; char *bp_tmp_file; #ifndef _WIN32 char *address; @@ -779,6 +781,7 @@ phpdbg_main: opt = 0; run = 0; step = 0; + sapi_name = NULL; while ((opt = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 0, 2)) != -1) { switch (opt) { @@ -832,9 +835,19 @@ phpdbg_main: case 'e': { /* set execution context */ exec_len = strlen(php_optarg); if (exec_len) { + if (exec) { + free(exec); + } exec = strdup(php_optarg); } } break; + + case 'S': { /* set SAPI name */ + if (sapi_name) { + free(sapi_name); + } + sapi_name = strdup(php_optarg); + } break; case 'I': { /* ignore .phpdbginit */ init_file_default = 0; @@ -913,6 +926,10 @@ phpdbg_main: } #endif + if (sapi_name) { + phpdbg->name = sapi_name; + } + phpdbg->ini_defaults = phpdbg_ini_defaults; phpdbg->phpinfo_as_text = 1; phpdbg->php_ini_ignore_cwd = 1; @@ -1142,6 +1159,10 @@ phpdbg_out: free(address); } #endif + + if (sapi_name) { + free(sapi_name); + } free(bp_tmp_file); diff --git a/phpdbg_help.c b/phpdbg_help.c index 6ae77fd99b..964f7624fa 100644 --- a/phpdbg_help.c +++ b/phpdbg_help.c @@ -564,6 +564,7 @@ PHPDBG_HELP(options) /* {{{ */ phpdbg_writeln(" -O\t-Omy.oplog\t\tSets oplog output file"); phpdbg_writeln(" -r\tN/A\t\t\tRun execution context"); phpdbg_writeln(" -E\tN/A\t\t\tEnable step through eval, careful !"); + phpdbg_writeln(" -S\t-Scli\t\t\tOverride SAPI name, careful !"); #ifndef _WIN32 phpdbg_writeln(" -l\t-l4000\t\t\tSetup remote console ports"); phpdbg_writeln(" -a\t-a192.168.0.3\t\tSetup remote console bind address");