com php-src: fix crash on startup errors: phpdbg.c
| From: | Bob Weinand | Date: | Thu, 05 Dec 2013 11:20:16 +0000 |
| Subject: | com php-src: fix crash on startup errors: phpdbg.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75314@lists.php.net to get a copy of this message | ||
Commit: f4f17d6e3208c9c1b714da976a22f37af082e98b
Author: krakjoe <joe.watkins@live.co.uk> Thu, 5 Dec 2013 11:20:16 +0000
Parents: 56da40980156d6ca58a0e911fb126fe3ba30282c
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f4f17d6e3208c9c1b714da976a22f37af082e98b
Log:
fix crash on startup errors
Changed paths:
M phpdbg.c
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index 0dcd80e..2a87265 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -39,6 +39,8 @@
ZEND_DECLARE_MODULE_GLOBALS(phpdbg);
+static zend_bool phpdbg_booted = 0;
+
#if PHP_VERSION_ID >= 50500
void (*zend_execute_old)(zend_execute_data *execute_data TSRMLS_DC);
#else
@@ -338,6 +340,9 @@ static inline int php_sapi_phpdbg_module_startup(sapi_module_struct *module) /*
if (php_module_startup(module, &sapi_phpdbg_module_entry, 1) == FAILURE) {
return FAILURE;
}
+
+ phpdbg_booted=1;
+
return SUCCESS;
} /* }}} */
@@ -367,7 +372,12 @@ static void php_sapi_phpdbg_send_header(sapi_header_struct *sapi_header, void
*s
static void php_sapi_phpdbg_log_message(char *message TSRMLS_DC) /* {{{ */
{
- phpdbg_error("%s", message);
+ /*
+ * We must not request TSRM before being boot
+ */
+ if (phpdbg_booted) {
+ phpdbg_error("%s", message);
+ } else fprintf(stdout, "%s\n", message);
}
/* }}} */
@@ -988,9 +998,9 @@ phpdbg_main:
}
phpdbg->ini_entries = ini_entries;
-
- if (phpdbg->startup(phpdbg) == SUCCESS) {
+ if (phpdbg->startup(phpdbg) == SUCCESS) {
+
zend_activate(TSRMLS_C);
/* do not install sigint handlers for remote consoles */