From: Antony Dovgal Date: Mon, 11 Sep 2006 14:30:08 +0000 (+0000) Subject: MFH: fix #38779 (engine crashes when require()'ing file with syntax error through... X-Git-Tag: php-5.2.0RC4~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d6ee9d48109814a3ba8e9879f5ab63466f4327be;p=php MFH: fix #38779 (engine crashes when require()'ing file with syntax error through userspace stream wrapper) --- diff --git a/Zend/zend.c b/Zend/zend.c index 9b03aa45c8..fbef8186c7 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -503,6 +503,7 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS EG(current_execute_data) = NULL; EG(current_module) = NULL; EG(exit_status) = 0; + EG(active) = 0; } diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 4170a30e7c..ab535ea74d 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -188,6 +188,8 @@ void init_executor(TSRMLS_D) EG(scope) = NULL; EG(This) = NULL; + + EG(active) = 1; } static int zval_call_destructor(zval **zv TSRMLS_DC) @@ -316,6 +318,7 @@ void shutdown_executor(TSRMLS_D) FREE_HASHTABLE(EG(in_autoload)); } } zend_end_try(); + EG(active) = 0; } @@ -613,6 +616,10 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS char *fname, *colon; int fname_len; + if (!EG(active)) { + return FAILURE; /* executor is already inactive */ + } + if (EG(exception)) { return FAILURE; /* we would result in an instable executor otherwise */ } diff --git a/Zend/zend_globals.h b/Zend/zend_globals.h index 53c51e9b64..4bc92a4477 100644 --- a/Zend/zend_globals.h +++ b/Zend/zend_globals.h @@ -237,6 +237,8 @@ struct _zend_executor_globals { zend_property_info std_property_info; + zend_bool active; + void *reserved[ZEND_MAX_RESERVED_RESOURCES]; };