From: Dmitry Stogov Date: Thu, 31 Jul 2014 06:52:48 +0000 (+0400) Subject: Fixed check for eval() X-Git-Tag: POST_PHPNG_MERGE~41^2~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=72753068873921ad4b970623c1e727f9a7d7b5eb;p=php Fixed check for eval() --- diff --git a/main/main.c b/main/main.c index f4f88d5360..3b9330e875 100644 --- a/main/main.c +++ b/main/main.c @@ -1192,10 +1192,19 @@ static void php_error_cb(int type, const char *error_filename, const uint error_ case E_USER_ERROR: { /* new block to allow variable definition */ /* eval() errors do not affect exit_status or response code */ - zend_bool during_eval = (type == E_PARSE) && (EG(current_execute_data) && - EG(current_execute_data)->opline && - EG(current_execute_data)->opline->opcode == ZEND_INCLUDE_OR_EVAL && - EG(current_execute_data)->opline->extended_value == ZEND_EVAL); + zend_bool during_eval = 0; + + if (type == E_PARSE) { + zend_execute_data *execute_data = EG(current_execute_data); + + while (execute_data && (!execute_data->func || !ZEND_USER_CODE(execute_data->func->common.type))) { + execute_data = execute_data->prev_execute_data; + } + + during_eval = (execute_data && + execute_data->opline->opcode == ZEND_INCLUDE_OR_EVAL && + execute_data->opline->extended_value == ZEND_EVAL); + } if (!during_eval) { EG(exit_status) = 255; }