Created
February 15, 2015 17:43
-
-
Save pierrejoye/622ae9c5a5aece295f18 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/Zend/zend.c b/Zend/zend.c | |
| index 942b0a0..8b909ee 100644 | |
| --- a/Zend/zend.c | |
| +++ b/Zend/zend.c | |
| @@ -1245,6 +1245,61 @@ ZEND_API void zend_output_debug_string(zend_bool trigger_break, const char *form | |
| } | |
| /* }}} */ | |
| + | |
| +ZEND_API int zend_execute_string(int type, zval *retval, char *string, size_t len, const char *filename) /* {{{ */ | |
| +{ | |
| + zend_op_array *op_array; | |
| + | |
| + file_handle = va_arg(files, zend_file_handle *); | |
| + if (!file_handle) { | |
| + continue; | |
| + } | |
| + | |
| + op_array = zend_compile_file(file_handle, type); | |
| + if (file_handle->opened_path) { | |
| + zend_hash_str_add_empty_element(&EG(included_files), file_handle->opened_path, strlen(file_handle->opened_path)); | |
| + } | |
| + zend_destroy_file_handle(file_handle); | |
| + if (op_array) { | |
| + zend_execute(op_array, retval); | |
| + zend_exception_restore(); | |
| + if (EG(exception)) { | |
| + if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) { | |
| + zval orig_user_exception_handler; | |
| + zval params[1], retval2; | |
| + zend_object *old_exception; | |
| + old_exception = EG(exception); | |
| + EG(exception) = NULL; | |
| + ZVAL_OBJ(¶ms[0], old_exception); | |
| + ZVAL_COPY_VALUE(&orig_user_exception_handler, &EG(user_exception_handler)); | |
| + ZVAL_UNDEF(&retval2); | |
| + if (call_user_function_ex(CG(function_table), NULL, &orig_user_exception_handler, &retval2, 1, params, 1, NULL) == SUCCESS) { | |
| + zval_ptr_dtor(&retval2); | |
| + if (EG(exception)) { | |
| + OBJ_RELEASE(EG(exception)); | |
| + EG(exception) = NULL; | |
| + } | |
| + OBJ_RELEASE(old_exception); | |
| + } else { | |
| + EG(exception) = old_exception; | |
| + zend_exception_error(EG(exception), E_ERROR); | |
| + } | |
| + } else { | |
| + zend_exception_error(EG(exception), E_ERROR); | |
| + } | |
| + } | |
| + destroy_op_array(op_array); | |
| + efree_size(op_array, sizeof(zend_op_array)); | |
| + } else if (type==ZEND_REQUIRE) { | |
| + va_end(files); | |
| + return FAILURE; | |
| + } | |
| + return SUCCESS; | |
| +} | |
| +/* }}} */ | |
| + | |
| + |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment