]> granicus.if.org Git - php/commitdiff
Bugfix: #26591 [NEW]: "__autoload threw an exception" during an uncaught
authorMarcus Boerger <helly@php.net>
Thu, 11 Dec 2003 18:18:52 +0000 (18:18 +0000)
committerMarcus Boerger <helly@php.net>
Thu, 11 Dec 2003 18:18:52 +0000 (18:18 +0000)
Exception

Zend/zend_execute_API.c

index 77f09ef14469b0567fb477d57dbcf255d2246e01..ef75f95c75df7ec4b163a5956edc65243d79812c 100644 (file)
@@ -781,6 +781,7 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
        zval *retval_ptr;
        int retval;
        char *lc_name;
+       zval *exception;
 
        lc_name = do_alloca(name_length + 1);
        zend_str_tolower_copy(lc_name, name, name_length+1);
@@ -797,17 +798,22 @@ ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***
        
        args[0] = &class_name_ptr;
 
+       exception = EG(exception);
+       EG(exception) = NULL;
        retval = call_user_function_ex(EG(function_table), NULL, &autoload_function, &retval_ptr, 1, args, 0, NULL TSRMLS_CC);
 
        if (retval == FAILURE) {
+               EG(exception) = exception;
                free_alloca(lc_name);
                return FAILURE;
        }
 
        if (EG(exception)) {
                free_alloca(lc_name);
-               zend_error(E_ERROR, "__autoload threw an exception");
+               zend_error(E_ERROR, "__autoload(%s) threw an exception of type '%s'", name, Z_OBJCE_P(EG(exception))->name);
+               return FAILURE;
        }
+       EG(exception) = exception;
 
        /* If an exception is thrown retval_ptr will be NULL but we bailout before we reach this point */
        zval_ptr_dtor(&retval_ptr);