]> granicus.if.org Git - php/commitdiff
added ability to override sapi name
authorkrakjoe <joe.watkins@live.co.uk>
Mon, 2 Dec 2013 14:45:41 +0000 (14:45 +0000)
committerkrakjoe <joe.watkins@live.co.uk>
Mon, 2 Dec 2013 14:45:41 +0000 (14:45 +0000)
Changelog.md
phpdbg.c
phpdbg_help.c

index 8e817ca212f8d5c4596d489853d3dc5630d38639..aed299cab148b626b3cccf11a129978118427f2d 100644 (file)
@@ -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
 ------------------------
index 602cc0bddaadd44d03b9921518ac4748432a1eca..bbe992c930eb84948b3ad77135bdfec628f2625b 100644 (file)
--- 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);
 
index 6ae77fd99be1d4efd47b322546f5d469be527542..964f7624fac9f014f526fd23c2e2d3bcb57500fd 100644 (file)
@@ -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");