@@ -3851,12 +3851,12 @@ static void zend_do_traits_method_binding(zend_class_entry *ce TSRMLS_DC) /* {{{
3851
3851
free (resulting_table );
3852
3852
}
3853
3853
3854
- static zend_class_entry * find_first_definition (zend_class_entry * ce , size_t current_trait , char * prop_name , int prop_name_length , zend_class_entry * coliding_ce ) /* {{{ */
3854
+ static zend_class_entry * find_first_definition (zend_class_entry * ce , size_t current_trait , char * prop_name , int prop_name_length , ulong prop_hash , zend_class_entry * coliding_ce ) /* {{{ */
3855
3855
{
3856
3856
size_t i ;
3857
3857
zend_property_info * coliding_prop ;
3858
3858
for (i = 0 ; (i < current_trait ) && (i < ce -> num_traits ); i ++ ) {
3859
- if (zend_hash_find (& ce -> traits [i ]-> properties_info , prop_name , prop_name_length + 1 , (void * * ) & coliding_prop ) == SUCCESS ) {
3859
+ if (zend_hash_quick_find (& ce -> traits [i ]-> properties_info , prop_name , prop_name_length + 1 , prop_hash , (void * * ) & coliding_prop ) == SUCCESS ) {
3860
3860
return ce -> traits [i ];
3861
3861
}
3862
3862
}
@@ -3872,6 +3872,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
3872
3872
zval compare_result ;
3873
3873
char * prop_name ;
3874
3874
int prop_name_length ;
3875
+ ulong prop_hash ;
3875
3876
char * class_name_unused ;
3876
3877
zend_bool prop_found ;
3877
3878
zend_bool not_compatible ;
@@ -3894,6 +3895,7 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
3894
3895
/* first get the unmangeld name if necessary,
3895
3896
then check whether the property is already there */
3896
3897
if ((property_info -> flags & ZEND_ACC_PPP_MASK ) == ZEND_ACC_PUBLIC ) {
3898
+ prop_hash = property_info -> h ;
3897
3899
prop_name = property_info -> name ;
3898
3900
prop_name_length = property_info -> name_length ;
3899
3901
prop_found = zend_hash_quick_find (& ce -> properties_info ,
@@ -3904,14 +3906,15 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
3904
3906
zend_unmangle_property_name (property_info -> name , property_info -> name_length ,
3905
3907
& class_name_unused , & prop_name );
3906
3908
prop_name_length = strlen (prop_name );
3907
- prop_found = zend_hash_find (& ce -> properties_info , prop_name , prop_name_length + 1 , (void * * ) & coliding_prop ) == SUCCESS ;
3909
+ prop_hash = zend_get_hash_value (prop_name , prop_name_length + 1 );
3910
+ prop_found = zend_hash_quick_find (& ce -> properties_info , prop_name , prop_name_length + 1 , prop_hash , (void * * ) & coliding_prop ) == SUCCESS ;
3908
3911
}
3909
3912
3910
3913
/* next: check for conflicts with current class */
3911
3914
if (prop_found ) {
3912
3915
if (coliding_prop -> flags & ZEND_ACC_SHADOW ) {
3913
3916
/* this one is inherited, lets look it up in its own class */
3914
- zend_hash_find (& coliding_prop -> ce -> properties_info , prop_name , prop_name_length + 1 , (void * * ) & coliding_prop );
3917
+ zend_hash_quick_find (& coliding_prop -> ce -> properties_info , prop_name , prop_name_length + 1 , prop_hash , (void * * ) & coliding_prop );
3915
3918
}
3916
3919
if ((coliding_prop -> flags & ZEND_ACC_PPP_MASK ) == (property_info -> flags & ZEND_ACC_PPP_MASK )) {
3917
3920
/* flags are identical, now the value needs to be checked */
@@ -3921,8 +3924,8 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
3921
3924
ce -> traits [i ]-> default_static_members_table [property_info -> offset ] TSRMLS_CC ) == FAILURE ;
3922
3925
} else {
3923
3926
not_compatible = compare_function (& compare_result ,
3924
- ce -> default_properties_table [coliding_prop -> offset ],
3925
- ce -> traits [i ]-> default_properties_table [property_info -> offset ] TSRMLS_CC ) == FAILURE ;
3927
+ ce -> default_properties_table [coliding_prop -> offset ],
3928
+ ce -> traits [i ]-> default_properties_table [property_info -> offset ] TSRMLS_CC ) == FAILURE ;
3926
3929
}
3927
3930
} else {
3928
3931
/* the flags are not identical, thus, we assume properties are not compatible */
@@ -3932,14 +3935,14 @@ static void zend_do_traits_property_binding(zend_class_entry *ce TSRMLS_DC) /* {
3932
3935
if (not_compatible ) {
3933
3936
zend_error (E_COMPILE_ERROR ,
3934
3937
"%s and %s define the same property ($%s) in the composition of %s. However, the definition differs and is considered incompatible. Class was composed" ,
3935
- find_first_definition (ce , i , prop_name , prop_name_length , coliding_prop -> ce )-> name ,
3938
+ find_first_definition (ce , i , prop_name , prop_name_length , prop_hash , coliding_prop -> ce )-> name ,
3936
3939
property_info -> ce -> name ,
3937
3940
prop_name ,
3938
3941
ce -> name );
3939
3942
} else {
3940
3943
zend_error (E_STRICT ,
3941
3944
"%s and %s define the same property ($%s) in the composition of %s. This might be incompatible, to improve maintainability consider using accessor methods in traits instead. Class was composed" ,
3942
- find_first_definition (ce , i , prop_name , prop_name_length , coliding_prop -> ce )-> name ,
3945
+ find_first_definition (ce , i , prop_name , prop_name_length , prop_hash , coliding_prop -> ce )-> name ,
3943
3946
property_info -> ce -> name ,
3944
3947
prop_name ,
3945
3948
ce -> name );
0 commit comments