@@ -1024,7 +1024,7 @@ static zend_always_inline void zend_verify_return_type(zend_function *zf, zval *
1024
1024
}
1025
1025
}
1026
1026
1027
- static ZEND_COLD int zend_verify_missing_return_type (zend_function * zf , void * * cache_slot )
1027
+ static ZEND_COLD int zend_verify_missing_return_type (const zend_function * zf , void * * cache_slot )
1028
1028
{
1029
1029
zend_arg_info * ret_info = zf -> common .arg_info - 1 ;
1030
1030
@@ -1046,10 +1046,20 @@ static ZEND_COLD int zend_verify_missing_return_type(zend_function *zf, void **c
1046
1046
return 1 ;
1047
1047
}
1048
1048
1049
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_object_as_array (void )
1050
+ {
1051
+ zend_throw_error (NULL , "Cannot use object as array" );
1052
+ }
1053
+
1054
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_illegal_offset (void )
1055
+ {
1056
+ zend_error (E_WARNING , "Illegal offset type" );
1057
+ }
1058
+
1049
1059
static zend_never_inline void zend_assign_to_object_dim (zval * object , zval * dim , zval * value )
1050
1060
{
1051
1061
if (UNEXPECTED (!Z_OBJ_HT_P (object )-> write_dimension )) {
1052
- zend_throw_error ( NULL , "Cannot use object as array" );
1062
+ zend_use_object_as_array ( );
1053
1063
return ;
1054
1064
}
1055
1065
@@ -1117,7 +1127,7 @@ static zend_never_inline zend_long zend_check_string_offset(zval *dim, int type
1117
1127
dim = Z_REFVAL_P (dim );
1118
1128
goto try_again ;
1119
1129
default :
1120
- zend_error ( E_WARNING , "Illegal offset type" );
1130
+ zend_illegal_offset ( );
1121
1131
break ;
1122
1132
}
1123
1133
@@ -1291,6 +1301,14 @@ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_wrong_property_check(
1291
1301
zend_tmp_string_release (property_name );
1292
1302
}
1293
1303
1304
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_deprecated_function (const zend_function * fbc )
1305
+ {
1306
+ zend_error (E_DEPRECATED , "Function %s%s%s() is deprecated" ,
1307
+ fbc -> common .scope ? ZSTR_VAL (fbc -> common .scope -> name ) : "" ,
1308
+ fbc -> common .scope ? "::" : "" ,
1309
+ ZSTR_VAL (fbc -> common .function_name ));
1310
+ }
1311
+
1294
1312
static zend_never_inline void zend_assign_to_string_offset (zval * str , zval * dim , zval * value , zval * result EXECUTE_DATA_DC )
1295
1313
{
1296
1314
zend_uchar c ;
@@ -1532,6 +1550,87 @@ static zend_always_inline HashTable *zend_get_target_symbol_table(int fetch_type
1532
1550
return ht ;
1533
1551
}
1534
1552
1553
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_undefined_offset (zend_long lval )
1554
+ {
1555
+ zend_error (E_NOTICE , "Undefined offset: " ZEND_LONG_FMT , lval );
1556
+ }
1557
+
1558
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_undefined_index (const zend_string * offset )
1559
+ {
1560
+ zend_error (E_NOTICE , "Undefined index: %s" , ZSTR_VAL (offset ));
1561
+ }
1562
+
1563
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_undefined_method (const zend_class_entry * ce , const zend_string * method )
1564
+ {
1565
+ zend_throw_error (NULL , "Call to undefined method %s::%s()" , ZSTR_VAL (ce -> name ), ZSTR_VAL (method ));
1566
+ }
1567
+
1568
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_invalid_method_call (zval * object , zval * function_name )
1569
+ {
1570
+ zend_throw_error (NULL , "Call to a member function %s() on %s" , Z_STRVAL_P (function_name ), zend_get_type_by_const (Z_TYPE_P (object )));
1571
+ }
1572
+
1573
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_non_static_method_call (const zend_function * fbc )
1574
+ {
1575
+ if (fbc -> common .fn_flags & ZEND_ACC_ALLOW_STATIC ) {
1576
+ zend_error (E_DEPRECATED ,
1577
+ "Non-static method %s::%s() should not be called statically" ,
1578
+ ZSTR_VAL (fbc -> common .scope -> name ), ZSTR_VAL (fbc -> common .function_name ));
1579
+ } else {
1580
+ zend_throw_error (
1581
+ zend_ce_error ,
1582
+ "Non-static method %s::%s() cannot be called statically" ,
1583
+ ZSTR_VAL (fbc -> common .scope -> name ), ZSTR_VAL (fbc -> common .function_name ));
1584
+ }
1585
+ }
1586
+
1587
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_param_must_be_ref (const zend_function * func , uint32_t arg_num )
1588
+ {
1589
+ zend_error (E_WARNING , "Parameter %d to %s%s%s() expected to be a reference, value given" ,
1590
+ arg_num ,
1591
+ func -> common .scope ? ZSTR_VAL (func -> common .scope -> name ) : "" ,
1592
+ func -> common .scope ? "::" : "" ,
1593
+ ZSTR_VAL (func -> common .function_name ));
1594
+ }
1595
+
1596
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_scalar_as_array (void )
1597
+ {
1598
+ zend_error (E_WARNING , "Cannot use a scalar value as an array" );
1599
+ }
1600
+
1601
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_cannot_add_element (void )
1602
+ {
1603
+ zend_error (E_WARNING , "Cannot add element to the array as the next element is already occupied" );
1604
+ }
1605
+
1606
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_resource_as_offset (const zval * dim )
1607
+ {
1608
+ zend_error (E_NOTICE , "Resource ID#%d used as offset, casting to integer (%d)" , Z_RES_HANDLE_P (dim ), Z_RES_HANDLE_P (dim ));
1609
+ }
1610
+
1611
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_use_new_element_for_string (void )
1612
+ {
1613
+ zend_throw_error (NULL , "[] operator not supported for strings" );
1614
+ }
1615
+
1616
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_modify_property_of_non_object (zval * property )
1617
+ {
1618
+ zend_string * tmp ;
1619
+ zend_string * property_name = zval_get_tmp_string (property , & tmp );
1620
+ zend_error (E_WARNING , "Attempt to modify property '%s' of non-object" , ZSTR_VAL (property_name ));
1621
+ zend_tmp_string_release (tmp );
1622
+ }
1623
+
1624
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_access_undefined_propery_in_overloaded_object (void )
1625
+ {
1626
+ zend_throw_error (NULL , "Cannot access undefined property for object with overloaded property access" );
1627
+ }
1628
+
1629
+ static zend_never_inline ZEND_COLD void ZEND_FASTCALL zend_unsupported_property_reference (void )
1630
+ {
1631
+ zend_error (E_WARNING , "This object doesn't support property references" );
1632
+ }
1633
+
1535
1634
static zend_always_inline zval * zend_fetch_dimension_address_inner (HashTable * ht , const zval * dim , int dim_type , int type EXECUTE_DATA_DC )
1536
1635
{
1537
1636
zval * retval ;
@@ -1547,14 +1646,14 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
1547
1646
num_undef :
1548
1647
switch (type ) {
1549
1648
case BP_VAR_R :
1550
- zend_error ( E_NOTICE , "Undefined offset: " ZEND_LONG_FMT , hval );
1649
+ zend_undefined_offset ( hval );
1551
1650
/* break missing intentionally */
1552
1651
case BP_VAR_UNSET :
1553
1652
case BP_VAR_IS :
1554
1653
retval = & EG (uninitialized_zval );
1555
1654
break ;
1556
1655
case BP_VAR_RW :
1557
- zend_error ( E_NOTICE , "Undefined offset: " ZEND_LONG_FMT , hval );
1656
+ zend_undefined_offset ( hval );
1558
1657
retval = zend_hash_index_update (ht , hval , & EG (uninitialized_zval ));
1559
1658
break ;
1560
1659
case BP_VAR_W :
@@ -1577,14 +1676,14 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
1577
1676
if (UNEXPECTED (Z_TYPE_P (retval ) == IS_UNDEF )) {
1578
1677
switch (type ) {
1579
1678
case BP_VAR_R :
1580
- zend_error ( E_NOTICE , "Undefined index: %s" , ZSTR_VAL ( offset_key ) );
1679
+ zend_undefined_index ( offset_key );
1581
1680
/* break missing intentionally */
1582
1681
case BP_VAR_UNSET :
1583
1682
case BP_VAR_IS :
1584
1683
retval = & EG (uninitialized_zval );
1585
1684
break ;
1586
1685
case BP_VAR_RW :
1587
- zend_error ( E_NOTICE , "Undefined index: %s" , ZSTR_VAL ( offset_key ) );
1686
+ zend_undefined_index ( offset_key );
1588
1687
/* break missing intentionally */
1589
1688
case BP_VAR_W :
1590
1689
ZVAL_NULL (retval );
@@ -1595,14 +1694,14 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
1595
1694
} else {
1596
1695
switch (type ) {
1597
1696
case BP_VAR_R :
1598
- zend_error ( E_NOTICE , "Undefined index: %s" , ZSTR_VAL ( offset_key ) );
1697
+ zend_undefined_index ( offset_key );
1599
1698
/* break missing intentionally */
1600
1699
case BP_VAR_UNSET :
1601
1700
case BP_VAR_IS :
1602
1701
retval = & EG (uninitialized_zval );
1603
1702
break ;
1604
1703
case BP_VAR_RW :
1605
- zend_error ( E_NOTICE , "Undefined index: %s" , ZSTR_VAL ( offset_key ) );
1704
+ zend_undefined_index ( offset_key );
1606
1705
retval = zend_hash_update (ht , offset_key , & EG (uninitialized_zval ));
1607
1706
break ;
1608
1707
case BP_VAR_W :
@@ -1622,7 +1721,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
1622
1721
hval = zend_dval_to_lval (Z_DVAL_P (dim ));
1623
1722
goto num_index ;
1624
1723
case IS_RESOURCE :
1625
- zend_error ( E_NOTICE , "Resource ID#%d used as offset, casting to integer (%d)" , Z_RES_HANDLE_P ( dim ), Z_RES_HANDLE_P ( dim ) );
1724
+ zend_use_resource_as_offset ( dim );
1626
1725
hval = Z_RES_HANDLE_P (dim );
1627
1726
goto num_index ;
1628
1727
case IS_FALSE :
@@ -1635,7 +1734,7 @@ static zend_always_inline zval *zend_fetch_dimension_address_inner(HashTable *ht
1635
1734
dim = Z_REFVAL_P (dim );
1636
1735
goto try_again ;
1637
1736
default :
1638
- zend_error ( E_WARNING , "Illegal offset type" );
1737
+ zend_illegal_offset ( );
1639
1738
retval = (type == BP_VAR_W || type == BP_VAR_RW ) ?
1640
1739
NULL : & EG (uninitialized_zval );
1641
1740
}
@@ -1674,7 +1773,7 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval *
1674
1773
if (dim == NULL ) {
1675
1774
retval = zend_hash_next_index_insert (Z_ARRVAL_P (container ), & EG (uninitialized_zval ));
1676
1775
if (UNEXPECTED (retval == NULL )) {
1677
- zend_error ( E_WARNING , "Cannot add element to the array as the next element is already occupied" );
1776
+ zend_cannot_add_element ( );
1678
1777
ZVAL_ERROR (result );
1679
1778
return ;
1680
1779
}
@@ -1695,7 +1794,7 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval *
1695
1794
}
1696
1795
if (UNEXPECTED (Z_TYPE_P (container ) == IS_STRING )) {
1697
1796
if (dim == NULL ) {
1698
- zend_throw_error ( NULL , "[] operator not supported for strings" );
1797
+ zend_use_new_element_for_string ( );
1699
1798
} else {
1700
1799
zend_check_string_offset (dim , type EXECUTE_DATA_CC );
1701
1800
zend_wrong_string_offset (EXECUTE_DATA_C );
@@ -1707,7 +1806,7 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval *
1707
1806
dim = & EG (uninitialized_zval );
1708
1807
}
1709
1808
if (!Z_OBJ_HT_P (container )-> read_dimension ) {
1710
- zend_throw_error ( NULL , "Cannot use object as array" );
1809
+ zend_use_object_as_array ( );
1711
1810
ZVAL_ERROR (result );
1712
1811
} else {
1713
1812
retval = Z_OBJ_HT_P (container )-> read_dimension (container , dim , type , result );
@@ -1759,7 +1858,7 @@ static zend_always_inline void zend_fetch_dimension_address(zval *result, zval *
1759
1858
zend_error (E_WARNING , "Cannot unset offset in a non-array variable" );
1760
1859
ZVAL_NULL (result );
1761
1860
} else {
1762
- zend_error ( E_WARNING , "Cannot use a scalar value as an array" );
1861
+ zend_use_scalar_as_array ( );
1763
1862
ZVAL_ERROR (result );
1764
1863
}
1765
1864
}
@@ -1829,7 +1928,7 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
1829
1928
dim = Z_REFVAL_P (dim );
1830
1929
goto try_string_offset ;
1831
1930
default :
1832
- zend_error ( E_WARNING , "Illegal offset type" );
1931
+ zend_illegal_offset ( );
1833
1932
break ;
1834
1933
}
1835
1934
@@ -1861,7 +1960,7 @@ static zend_always_inline void zend_fetch_dimension_address_read(zval *result, z
1861
1960
dim = & EG (uninitialized_zval );
1862
1961
}
1863
1962
if (!Z_OBJ_HT_P (container )-> read_dimension ) {
1864
- zend_throw_error ( NULL , "Cannot use object as array" );
1963
+ zend_use_object_as_array ( );
1865
1964
ZVAL_NULL (result );
1866
1965
} else {
1867
1966
retval = Z_OBJ_HT_P (container )-> read_dimension (container , dim , type , result );
@@ -1939,9 +2038,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
1939
2038
object_init (container );
1940
2039
} else {
1941
2040
if (container_op_type != IS_VAR || EXPECTED (!Z_ISERROR_P (container ))) {
1942
- zend_string * property_name = zval_get_string (prop_ptr );
1943
- zend_error (E_WARNING , "Attempt to modify property '%s' of non-object" , ZSTR_VAL (property_name ));
1944
- zend_string_release (property_name );
2041
+ zend_modify_property_of_non_object (prop_ptr );
1945
2042
}
1946
2043
ZVAL_ERROR (result );
1947
2044
return ;
@@ -1986,7 +2083,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
1986
2083
ZVAL_UNREF (ptr );
1987
2084
}
1988
2085
} else {
1989
- zend_throw_error ( NULL , "Cannot access undefined property for object with overloaded property access" );
2086
+ zend_access_undefined_propery_in_overloaded_object ( );
1990
2087
ZVAL_ERROR (result );
1991
2088
}
1992
2089
} else {
@@ -1995,7 +2092,7 @@ static zend_always_inline void zend_fetch_property_address(zval *result, zval *c
1995
2092
} else if (EXPECTED (Z_OBJ_HT_P (container )-> read_property )) {
1996
2093
goto use_read_property ;
1997
2094
} else {
1998
- zend_error ( E_WARNING , "This object doesn't support property references" );
2095
+ zend_unsupported_property_reference ( );
1999
2096
ZVAL_ERROR (result );
2000
2097
}
2001
2098
}
@@ -2581,7 +2678,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s
2581
2678
}
2582
2679
if (UNEXPECTED (fbc == NULL )) {
2583
2680
if (EXPECTED (!EG (exception ))) {
2584
- zend_throw_error ( NULL , "Call to undefined method %s::%s()" , ZSTR_VAL ( called_scope -> name ), ZSTR_VAL ( mname ) );
2681
+ zend_undefined_method ( called_scope , mname );
2585
2682
}
2586
2683
zend_string_release (lcname );
2587
2684
zend_string_release (mname );
@@ -2592,18 +2689,8 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_string(zend_s
2592
2689
zend_string_release (mname );
2593
2690
2594
2691
if (UNEXPECTED (!(fbc -> common .fn_flags & ZEND_ACC_STATIC ))) {
2595
- if (fbc -> common .fn_flags & ZEND_ACC_ALLOW_STATIC ) {
2596
- zend_error (E_DEPRECATED ,
2597
- "Non-static method %s::%s() should not be called statically" ,
2598
- ZSTR_VAL (fbc -> common .scope -> name ), ZSTR_VAL (fbc -> common .function_name ));
2599
- if (UNEXPECTED (EG (exception ) != NULL )) {
2600
- return NULL ;
2601
- }
2602
- } else {
2603
- zend_throw_error (
2604
- zend_ce_error ,
2605
- "Non-static method %s::%s() cannot be called statically" ,
2606
- ZSTR_VAL (fbc -> common .scope -> name ), ZSTR_VAL (fbc -> common .function_name ));
2692
+ zend_non_static_method_call (fbc );
2693
+ if (UNEXPECTED (EG (exception ) != NULL )) {
2607
2694
return NULL ;
2608
2695
}
2609
2696
}
@@ -2713,23 +2800,13 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar
2713
2800
}
2714
2801
if (UNEXPECTED (fbc == NULL )) {
2715
2802
if (EXPECTED (!EG (exception ))) {
2716
- zend_throw_error ( NULL , "Call to undefined method %s::%s()" , ZSTR_VAL ( called_scope -> name ), Z_STRVAL_P (method ));
2803
+ zend_undefined_method ( called_scope , Z_STR_P (method ));
2717
2804
}
2718
2805
return NULL ;
2719
2806
}
2720
2807
if (!(fbc -> common .fn_flags & ZEND_ACC_STATIC )) {
2721
- if (fbc -> common .fn_flags & ZEND_ACC_ALLOW_STATIC ) {
2722
- zend_error (E_DEPRECATED ,
2723
- "Non-static method %s::%s() should not be called statically" ,
2724
- ZSTR_VAL (fbc -> common .scope -> name ), ZSTR_VAL (fbc -> common .function_name ));
2725
- if (UNEXPECTED (EG (exception ) != NULL )) {
2726
- return NULL ;
2727
- }
2728
- } else {
2729
- zend_throw_error (
2730
- zend_ce_error ,
2731
- "Non-static method %s::%s() cannot be called statically" ,
2732
- ZSTR_VAL (fbc -> common .scope -> name ), ZSTR_VAL (fbc -> common .function_name ));
2808
+ zend_non_static_method_call (fbc );
2809
+ if (UNEXPECTED (EG (exception ) != NULL )) {
2733
2810
return NULL ;
2734
2811
}
2735
2812
}
@@ -2740,7 +2817,7 @@ static zend_never_inline zend_execute_data *zend_init_dynamic_call_array(zend_ar
2740
2817
fbc = Z_OBJ_HT_P (obj )-> get_method (& object , Z_STR_P (method ), NULL );
2741
2818
if (UNEXPECTED (fbc == NULL )) {
2742
2819
if (EXPECTED (!EG (exception ))) {
2743
- zend_throw_error ( NULL , "Call to undefined method %s::%s()" , ZSTR_VAL ( object -> ce -> name ), Z_STRVAL_P (method ));
2820
+ zend_undefined_method ( object -> ce , Z_STR_P (method ));
2744
2821
}
2745
2822
return NULL ;
2746
2823
}
0 commit comments