@@ -1479,6 +1479,28 @@ void zend_unset_timeout(void) /* {{{ */
1479
1479
}
1480
1480
/* }}} */
1481
1481
1482
+ static ZEND_COLD void report_class_fetch_error (zend_string * class_name , int fetch_type )
1483
+ {
1484
+ if (fetch_type & ZEND_FETCH_CLASS_SILENT ) {
1485
+ return ;
1486
+ }
1487
+
1488
+ if (EG (exception )) {
1489
+ if (!(fetch_type & ZEND_FETCH_CLASS_EXCEPTION )) {
1490
+ zend_exception_uncaught_error ("During class fetch" );
1491
+ }
1492
+ return ;
1493
+ }
1494
+
1495
+ if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_INTERFACE ) {
1496
+ zend_throw_or_error (fetch_type , NULL , "Interface \"%s\" not found" , ZSTR_VAL (class_name ));
1497
+ } else if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_TRAIT ) {
1498
+ zend_throw_or_error (fetch_type , NULL , "Trait \"%s\" not found" , ZSTR_VAL (class_name ));
1499
+ } else {
1500
+ zend_throw_or_error (fetch_type , NULL , "Class \"%s\" not found" , ZSTR_VAL (class_name ));
1501
+ }
1502
+ }
1503
+
1482
1504
zend_class_entry * zend_fetch_class (zend_string * class_name , int fetch_type ) /* {{{ */
1483
1505
{
1484
1506
zend_class_entry * ce , * scope ;
@@ -1520,15 +1542,7 @@ zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type) /* {
1520
1542
1521
1543
ce = zend_lookup_class_ex (class_name , NULL , fetch_type );
1522
1544
if (!ce ) {
1523
- if (!(fetch_type & ZEND_FETCH_CLASS_SILENT ) && !EG (exception )) {
1524
- if (fetch_sub_type == ZEND_FETCH_CLASS_INTERFACE ) {
1525
- zend_throw_or_error (fetch_type , NULL , "Interface \"%s\" not found" , ZSTR_VAL (class_name ));
1526
- } else if (fetch_sub_type == ZEND_FETCH_CLASS_TRAIT ) {
1527
- zend_throw_or_error (fetch_type , NULL , "Trait \"%s\" not found" , ZSTR_VAL (class_name ));
1528
- } else {
1529
- zend_throw_or_error (fetch_type , NULL , "Class \"%s\" not found" , ZSTR_VAL (class_name ));
1530
- }
1531
- }
1545
+ report_class_fetch_error (class_name , fetch_type );
1532
1546
return NULL ;
1533
1547
}
1534
1548
return ce ;
@@ -1539,22 +1553,7 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string
1539
1553
{
1540
1554
zend_class_entry * ce = zend_lookup_class_ex (class_name , key , fetch_type );
1541
1555
if (!ce ) {
1542
- if (fetch_type & ZEND_FETCH_CLASS_SILENT ) {
1543
- return NULL ;
1544
- }
1545
- if (EG (exception )) {
1546
- if (!(fetch_type & ZEND_FETCH_CLASS_EXCEPTION )) {
1547
- zend_exception_uncaught_error ("During class fetch" );
1548
- }
1549
- return NULL ;
1550
- }
1551
- if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_INTERFACE ) {
1552
- zend_throw_or_error (fetch_type , NULL , "Interface \"%s\" not found" , ZSTR_VAL (class_name ));
1553
- } else if ((fetch_type & ZEND_FETCH_CLASS_MASK ) == ZEND_FETCH_CLASS_TRAIT ) {
1554
- zend_throw_or_error (fetch_type , NULL , "Trait \"%s\" not found" , ZSTR_VAL (class_name ));
1555
- } else {
1556
- zend_throw_or_error (fetch_type , NULL , "Class \"%s\" not found" , ZSTR_VAL (class_name ));
1557
- }
1556
+ report_class_fetch_error (class_name , fetch_type );
1558
1557
return NULL ;
1559
1558
}
1560
1559
return ce ;
0 commit comments