]> granicus.if.org Git - php/commitdiff
- Fix conflict
authorFelipe Pena <felipensp@gmail.com>
Sun, 10 Nov 2013 17:51:20 +0000 (15:51 -0200)
committerFelipe Pena <felipensp@gmail.com>
Sun, 10 Nov 2013 17:51:20 +0000 (15:51 -0200)
1  2 
phpdbg.c
phpdbg.h
phpdbg_prompt.c
test.php

diff --cc phpdbg.c
index a0419f313eabcb3f837973ada9f8aa98dc942ac3,45377503898f15c6025314459f03220fbc710730..48b5728d77a8ee1135bb468857ff36021762f56f
+++ b/phpdbg.c
@@@ -48,16 -49,16 +49,16 @@@ static void php_phpdbg_destroy_break(vo
  
  static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */
  {
--      zend_hash_init(&PHPDBG_G(break_files),   8, NULL, php_phpdbg_destroy_break, 0);
--      zend_hash_init(&PHPDBG_G(break_symbols), 8, NULL, php_phpdbg_destroy_break, 0);
++      zend_hash_init(&PHPDBG_G(bp_files),   8, NULL, php_phpdbg_destroy_break, 0);
++      zend_hash_init(&PHPDBG_G(bp_symbols), 8, NULL, php_phpdbg_destroy_break, 0);
  
        return SUCCESS;
  } /* }}} */
  
  static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */
  {
--    zend_hash_destroy(&PHPDBG_G(break_files));
--    zend_hash_destroy(&PHPDBG_G(break_symbols));
++    zend_hash_destroy(&PHPDBG_G(bp_files));
++    zend_hash_destroy(&PHPDBG_G(bp_symbols));
  
      if (PHPDBG_G(exec)) {
          efree(PHPDBG_G(exec));
@@@ -128,6 -148,14 +148,14 @@@ void phpdbg_ini_defaults(HashTable *con
  int main(int argc, char **argv) /* {{{ */
  {
        sapi_module_struct *phpdbg = &phpdbg_sapi_module;
 -      
+       char *ini_file = NULL;
+       char *ini_entries = NULL;
+       int   ini_entries_len = 0;
+       char *ini_path_override = NULL;
+       char *php_optarg = NULL;
+     int php_optind = 0;
+     int opt;
++
  #ifdef ZTS
        void ***tsrm_ls;
        tsrm_startup(1, 1, 0, NULL);
        setmode(_fileno(stderr), O_BINARY); /* make the stdio mode be binary */
  #endif
  
-       phpdbg->executable_location = argv[0];
+     while ((opt = php_getopt(argc, argv, OPTIONS, &php_optarg, &php_optind, 1, 1)) != -1) {
+         switch (opt) {
 -            case 'c': 
++            case 'c':
+                 if (ini_path_override) {
+                     free(ini_path_override);
+                 }
+                 ini_path_override = strdup(php_optarg);
+             break;
+             case 'd': {
+                 int len = strlen(php_optarg);
+                           char *val;
 -                
++
+                           if ((val = strchr(php_optarg, '='))) {
+                                   val++;
+                                   if (!isalnum(*val) && *val != '"' && *val != '\'' && *val != '\0') {
+                                           ini_entries = realloc(ini_entries, ini_entries_len + len + sizeof("\"\"\n\0"));
+                                           memcpy(ini_entries + ini_entries_len, php_optarg, (val - php_optarg));
+                                           ini_entries_len += (val - php_optarg);
+                                           memcpy(ini_entries + ini_entries_len, "\"", 1);
+                                           ini_entries_len++;
+                                           memcpy(ini_entries + ini_entries_len, val, len - (val - php_optarg));
+                                           ini_entries_len += len - (val - php_optarg);
+                                           memcpy(ini_entries + ini_entries_len, "\"\n\0", sizeof("\"\n\0"));
+                                           ini_entries_len += sizeof("\n\0\"") - 2;
+                                   } else {
+                                           ini_entries = realloc(ini_entries, ini_entries_len + len + sizeof("\n\0"));
+                                           memcpy(ini_entries + ini_entries_len, php_optarg, len);
+                                           memcpy(ini_entries + ini_entries_len + len, "\n\0", sizeof("\n\0"));
+                                           ini_entries_len += len + sizeof("\n\0") - 2;
+                                   }
+                           } else {
+                                   ini_entries = realloc(ini_entries, ini_entries_len + len + sizeof("=1\n\0"));
+                                   memcpy(ini_entries + ini_entries_len, php_optarg, len);
+                                   memcpy(ini_entries + ini_entries_len + len, "=1\n\0", sizeof("=1\n\0"));
+                                   ini_entries_len += len + sizeof("=1\n\0") - 2;
+                           }
+             } break;
+         }
+     }
 -    
++
+     phpdbg->ini_defaults = phpdbg_ini_defaults;
+     phpdbg->php_ini_path_override = ini_path_override;
+       phpdbg->phpinfo_as_text = 1;
+       phpdbg->php_ini_ignore_cwd = 1;
 -    
 +
        sapi_startup(phpdbg);
  
 -    
+     phpdbg->executable_location = argv[0];
+     phpdbg->phpinfo_as_text = 1;
+     phpdbg->php_ini_ignore_cwd = 0;
+     phpdbg->php_ini_ignore = 0;
+     phpdbg->ini_entries = ini_entries;
++
        if (phpdbg->startup(phpdbg) == SUCCESS) {
                zend_activate(TSRMLS_C);
  
                zend_try {
                        phpdbg_interactive(argc, argv TSRMLS_CC);
                } zend_end_try();
 -              
 +
+               if (ini_file) {
+                   pefree(ini_file, 1);
+               }
 -              
++
+               if (ini_entries) {
+                   free(ini_entries);
+               }
                if (PG(modules_activated)) {
                        zend_try {
                                zend_deactivate_modules(TSRMLS_C);
diff --cc phpdbg.h
index 68c987a4295194bcf7dd345c5ab510ffc6eee358,087323009e4397206bf4f78c07df8a17ccb0ce96..427d22aa968d482013427d31af910d5f2cb37fc9
+++ b/phpdbg.h
@@@ -46,10 -47,10 +47,11 @@@ ZEND_BEGIN_MODULE_GLOBALS(phpdbg
        size_t exec_len;        /* size of exec */
        zend_op_array *ops;     /* op_array */
        zval *retval;           /* return value */
-       zend_bool stepping;     /* stepping */
+       int stepping;           /* stepping */
        int vmret;              /* return from last opcode handler execution */
        zend_bool has_file_bp;  /* file-based breakpoint has been set */
 +      zend_bool has_sym_bp;   /* symbol-based breakpoint has been set */
+       zend_bool quitting;     /* quitting flag */
  ZEND_END_MODULE_GLOBALS(phpdbg)
  
  #include "phpdbg_prompt.h"
diff --cc phpdbg_prompt.c
Simple merge
diff --cc test.php
index 0a10de16a93ebf1e545e73dab9fbb29a9c1eb1db,e907c3b6bf276475058152e792fdd856faa0ebae..d67540e1ed97e462486817259aa28a80b92d7664
+++ b/test.php
@@@ -1,8 -1,7 +1,9 @@@
  <?php
 -echo "Hello World\n";
 -if (isset($greeting)) {
 -    echo $greeting;
 +function test() {
 +      echo "Hello World\n";
 +}
 +if (!isset($greeting)) {
 +    echo test();
  }
+ return true;
  ?>