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