]> granicus.if.org Git - php/commitdiff
Fixed check for eval()
authorDmitry Stogov <dmitry@zend.com>
Thu, 31 Jul 2014 06:52:48 +0000 (10:52 +0400)
committerDmitry Stogov <dmitry@zend.com>
Thu, 31 Jul 2014 06:52:48 +0000 (10:52 +0400)
main/main.c

index f4f88d5360151ea58981b023a08eb8da013d6832..3b9330e87543b5648053d50725a98fe02e651248 100644 (file)
@@ -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;
                        }