@@ -1417,14 +1417,28 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string
1417
1417
if (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD ) {
1418
1418
return zend_lookup_class_ex (class_name , key , 0 );
1419
1419
} else if ((ce = zend_lookup_class_ex (class_name , key , 1 )) == NULL ) {
1420
- if ((fetch_type & ZEND_FETCH_CLASS_SILENT ) == 0 && !EG (exception )) {
1421
- if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_INTERFACE ) {
1422
- zend_throw_or_error (fetch_type , NULL , "Interface '%s' not found" , ZSTR_VAL (class_name ));
1423
- } else if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_TRAIT ) {
1424
- zend_throw_or_error (fetch_type , NULL , "Trait '%s' not found" , ZSTR_VAL (class_name ));
1425
- } else {
1426
- zend_throw_or_error (fetch_type , NULL , "Class '%s' not found" , ZSTR_VAL (class_name ));
1420
+ if (fetch_type & ZEND_FETCH_CLASS_SILENT ) {
1421
+ return NULL ;
1422
+ }
1423
+ if (EG (exception )) {
1424
+ if (!(fetch_type & ZEND_FETCH_CLASS_EXCEPTION )) {
1425
+ zend_string * exception_str ;
1426
+ zval exception_zv ;
1427
+ ZVAL_OBJ (& exception_zv , EG (exception ));
1428
+ Z_ADDREF (exception_zv );
1429
+ zend_clear_exception ();
1430
+ exception_str = zval_get_string (& exception_zv );
1431
+ zend_error_noreturn (E_ERROR ,
1432
+ "During class fetch: Uncaught %s" , ZSTR_VAL (exception_str ));
1427
1433
}
1434
+ return NULL ;
1435
+ }
1436
+ if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_INTERFACE ) {
1437
+ zend_throw_or_error (fetch_type , NULL , "Interface '%s' not found" , ZSTR_VAL (class_name ));
1438
+ } else if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_TRAIT ) {
1439
+ zend_throw_or_error (fetch_type , NULL , "Trait '%s' not found" , ZSTR_VAL (class_name ));
1440
+ } else {
1441
+ zend_throw_or_error (fetch_type , NULL , "Class '%s' not found" , ZSTR_VAL (class_name ));
1428
1442
}
1429
1443
return NULL ;
1430
1444
}
0 commit comments