@@ -1357,14 +1357,28 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string
1357
1357
if (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD ) {
1358
1358
return zend_lookup_class_ex (class_name , key , 0 );
1359
1359
} else if ((ce = zend_lookup_class_ex (class_name , key , 1 )) == NULL ) {
1360
- if ((fetch_type & ZEND_FETCH_CLASS_SILENT ) == 0 && !EG (exception )) {
1361
- if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_INTERFACE ) {
1362
- zend_throw_or_error (fetch_type , NULL , "Interface '%s' not found" , ZSTR_VAL (class_name ));
1363
- } else if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_TRAIT ) {
1364
- zend_throw_or_error (fetch_type , NULL , "Trait '%s' not found" , ZSTR_VAL (class_name ));
1365
- } else {
1366
- zend_throw_or_error (fetch_type , NULL , "Class '%s' not found" , ZSTR_VAL (class_name ));
1360
+ if (fetch_type & ZEND_FETCH_CLASS_SILENT ) {
1361
+ return NULL ;
1362
+ }
1363
+ if (EG (exception )) {
1364
+ if (!(fetch_type & ZEND_FETCH_CLASS_EXCEPTION )) {
1365
+ zend_string * exception_str ;
1366
+ zval exception_zv ;
1367
+ ZVAL_OBJ (& exception_zv , EG (exception ));
1368
+ Z_ADDREF (exception_zv );
1369
+ zend_clear_exception ();
1370
+ exception_str = zval_get_string (& exception_zv );
1371
+ zend_error_noreturn (E_ERROR ,
1372
+ "During class fetch: Uncaught %s" , ZSTR_VAL (exception_str ));
1367
1373
}
1374
+ return NULL ;
1375
+ }
1376
+ if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_INTERFACE ) {
1377
+ zend_throw_or_error (fetch_type , NULL , "Interface '%s' not found" , ZSTR_VAL (class_name ));
1378
+ } else if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_TRAIT ) {
1379
+ zend_throw_or_error (fetch_type , NULL , "Trait '%s' not found" , ZSTR_VAL (class_name ));
1380
+ } else {
1381
+ zend_throw_or_error (fetch_type , NULL , "Class '%s' not found" , ZSTR_VAL (class_name ));
1368
1382
}
1369
1383
return NULL ;
1370
1384
}
0 commit comments