com php-src: Merge branch 'PHP-7.0' into PHP-7.1: sapi/phpdbg/phpdbg.c
| From: | Bob Weinand | Date: | Sun, 16 Oct 2016 13:46:33 +0000 |
| Subject: | com php-src: Merge branch 'PHP-7.0' into PHP-7.1: sapi/phpdbg/phpdbg.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-95122@lists.php.net to get a copy of this message | ||
Commit: f8c2089651a2cdc9eb515afc7d64bc5392930c69
Author: Bob Weinand <bobwei9@hotmail.com> Sun, 16 Oct 2016 15:46:33 +0200
Parents: 47bd3d982eedf33ef73a8fb8e42b283da9fcee02 d82da7de3a460f1eee3d34448be79bca3de7abc1
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f8c2089651a2cdc9eb515afc7d64bc5392930c69
Log:
Merge branch 'PHP-7.0' into PHP-7.1
Changed paths:
MM sapi/phpdbg/phpdbg.c
Diff:
diff --cc sapi/phpdbg/phpdbg.c
index 36af9b3,de73c69..b800f06
--- a/sapi/phpdbg/phpdbg.c
+++ b/sapi/phpdbg/phpdbg.c
@@@ -1676,20 -1627,6 +1652,28 @@@ phpdbg_main
phpdbg->ini_entries = ini_entries;
+ ZEND_INIT_MODULE_GLOBALS(phpdbg, php_phpdbg_globals_ctor, NULL);
+
++ /* set default colors */
++ phpdbg_set_color_ex(PHPDBG_COLOR_PROMPT, PHPDBG_STRL("white-bold"));
++ phpdbg_set_color_ex(PHPDBG_COLOR_ERROR, PHPDBG_STRL("red-bold"));
++ phpdbg_set_color_ex(PHPDBG_COLOR_NOTICE, PHPDBG_STRL("green"));
++
++ /* set default prompt */
++ phpdbg_set_prompt(PHPDBG_DEFAULT_PROMPT);
++
+ if (settings > (zend_phpdbg_globals *) 0x2) {
+#ifdef ZTS
+ *((zend_phpdbg_globals *) (*((void ***)
TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(phpdbg_globals_id)]) = *settings;
+#else
+ phpdbg_globals = *settings;
+#endif
+ free(settings);
+ }
+
+ /* set flags from command line */
+ PHPDBG_G(flags) = flags;
+
if (phpdbg->startup(phpdbg) == SUCCESS) {
zend_mm_heap *mm_heap;
#ifdef _WIN32
@@@ -1700,9 -1637,62 +1684,46 @@@
void (*_free)(void*);
void* (*_realloc)(void*, size_t);
- /* set flags from command line */
- PHPDBG_G(flags) = flags;
-
- /* set default colors */
- phpdbg_set_color_ex(PHPDBG_COLOR_PROMPT, PHPDBG_STRL("white-bold"));
- phpdbg_set_color_ex(PHPDBG_COLOR_ERROR, PHPDBG_STRL("red-bold"));
- phpdbg_set_color_ex(PHPDBG_COLOR_NOTICE, PHPDBG_STRL("green"));
-
- /* set default prompt */
- phpdbg_set_prompt(PHPDBG_DEFAULT_PROMPT);
-
+ if (show_version || show_help) {
+ /* It ain't gonna proceed to real execution anyway,
+ but the correct descriptor is needed already. */
+ PHPDBG_G(io)[PHPDBG_STDOUT].ptr = stdout;
+ PHPDBG_G(io)[PHPDBG_STDOUT].fd = fileno(stdout);
+ if (show_help) {
+ phpdbg_do_help(NULL);
+ } else if (show_version) {
+ phpdbg_out(
+ "phpdbg %s (built: %s %s)\nPHP %s, Copyright (c) 1997-2016 The PHP Group\n%s",
+ PHPDBG_VERSION,
+ __DATE__,
+ __TIME__,
+ PHP_VERSION,
+ get_zend_version()
+ );
+ }
+ sapi_deactivate();
+ sapi_shutdown();
+ if (ini_entries) {
+ free(ini_entries);
+ }
+ if (ini_override) {
+ free(ini_override);
+ }
+ if (exec) {
+ free(exec);
+ }
+ if (oplog_file) {
+ free(oplog_file);
+ }
+ if (init_file) {
+ free(init_file);
+ }
+ goto free_and_return;
+ }
+
- if (settings > (zend_phpdbg_globals *) 0x2) {
-#ifdef ZTS
- *((zend_phpdbg_globals *) (*((void ***)
TSRMLS_CACHE))[TSRM_UNSHUFFLE_RSRC_ID(phpdbg_globals_id)]) = *settings;
-#else
- phpdbg_globals = *settings;
-#endif
- free(settings);
- }
+ zend_try {
+ zend_signal_activate();
+ } zend_end_try();
/* setup remote server if necessary */
if (cleaning <= 0 && listen > 0) {
@@@ -2146,18 -2142,11 +2159,19 @@@ phpdbg_out
/* reset it.... else we risk a stack overflow upon next run (when clean'ing) */
php_stream_stdio_ops.write = PHPDBG_G(php_stdiop_write);
#endif
+ }
+
+ sapi_shutdown();
+
+#ifdef ZTS
+ ts_free_id(phpdbg_globals_id);
+#endif
- sapi_shutdown();
+ if (sapi_name) {
+ free(sapi_name);
}
+ free_and_return:
if (read_from_stdin) {
free(read_from_stdin);
read_from_stdin = NULL;