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;
}