summaryrefslogtreecommitdiff
path: root/ext/spl/php_spl.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/spl/php_spl.c')
-rw-r--r--ext/spl/php_spl.c23
1 files changed, 6 insertions, 17 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 5ec20cd563..cd0a050b98 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -286,16 +286,7 @@ static int spl_autoload(zend_string *class_name, zend_string *lc_name, const cha
}
STR_RELEASE(opened_path);
if (new_op_array) {
- EG(active_op_array) = new_op_array;
- if (!EG(active_symbol_table)) {
- zend_rebuild_symbol_table(TSRMLS_C);
- }
-
ZVAL_UNDEF(&result);
- if (EG(current_execute_data)) {
- EG(current_execute_data)->call = zend_vm_stack_push_call_frame(
- (zend_function*)new_op_array, 0, 0, EG(called_scope), Z_OBJ(EG(This)), EG(current_execute_data)->call TSRMLS_CC);
- }
zend_execute(new_op_array, &result TSRMLS_CC);
destroy_op_array(new_op_array TSRMLS_CC);
@@ -319,8 +310,6 @@ PHP_FUNCTION(spl_autoload)
int found = 0, pos_len, pos1_len;
char *pos, *pos1;
zend_string *class_name, *lc_name, *file_exts = SPL_G(autoload_extensions);
- zend_op **original_opline_ptr = EG(opline_ptr);
- zend_op_array *original_active_op_array = EG(active_op_array);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &class_name, &file_exts) == FAILURE) {
RETURN_FALSE;
@@ -337,8 +326,6 @@ PHP_FUNCTION(spl_autoload)
lc_name = STR_ALLOC(class_name->len, 0);
zend_str_tolower_copy(lc_name->val, class_name->val, class_name->len);
while (pos && *pos && !EG(exception)) {
- EG(opline_ptr) = original_opline_ptr;
- EG(active_op_array) = original_active_op_array;
pos1 = strchr(pos, ',');
if (pos1) {
pos1_len = pos1 - pos;
@@ -354,15 +341,17 @@ PHP_FUNCTION(spl_autoload)
}
STR_FREE(lc_name);
- EG(opline_ptr) = original_opline_ptr;
- EG(active_op_array) = original_active_op_array;
-
if (!found && !SPL_G(autoload_running)) {
/* For internal errors, we generate E_ERROR, for direct calls an exception is thrown.
* The "scope" is determined by an opcode, if it is ZEND_FETCH_CLASS we know function was called indirectly by
* the Zend engine.
*/
- if (active_opline->opcode != ZEND_FETCH_CLASS) {
+ zend_execute_data *ex = EG(current_execute_data);
+
+ while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) {
+ ex = ex->prev_execute_data;
+ }
+ if (ex && ex->opline->opcode != ZEND_FETCH_CLASS) {
zend_throw_exception_ex(spl_ce_LogicException, 0 TSRMLS_CC, "Class %s could not be loaded", class_name->val);
} else {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Class %s could not be loaded", class_name->val);