summaryrefslogtreecommitdiff
path: root/ext/spl/php_spl.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-07-02 23:29:53 +0400
committerDmitry Stogov <dmitry@zend.com>2014-07-02 23:29:53 +0400
commit63c057e3313918a800ad7faebdb648216ddba4c0 (patch)
tree04ede4c58aa008868e82606b16cafc9d51757f87 /ext/spl/php_spl.c
parent4b09dd69e6bd31f4010bf48e9e07e63cb5f3c2a4 (diff)
downloadphp-git-63c057e3313918a800ad7faebdb648216ddba4c0.tar.gz
Removed EG(opline_ptr) and use corresponding value from EG(current_execute_data)
Diffstat (limited to 'ext/spl/php_spl.c')
-rw-r--r--ext/spl/php_spl.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 2daeff6603..8bab4ae3cf 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -318,7 +318,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);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "S|S", &class_name, &file_exts) == FAILURE) {
RETURN_FALSE;
@@ -335,7 +334,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;
pos1 = strchr(pos, ',');
if (pos1) {
pos1_len = pos1 - pos;
@@ -351,14 +349,17 @@ PHP_FUNCTION(spl_autoload)
}
STR_FREE(lc_name);
- EG(opline_ptr) = original_opline_ptr;
-
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 && 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);