@@ -1022,6 +1022,40 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
1022
1022
}
1023
1023
/* }}} */
1024
1024
1025
+ static int zval_update_class_constant (zval * * pp , int is_static , int offset TSRMLS_DC ) /* {{{ */
1026
+ {
1027
+ if ((Z_TYPE_PP (pp ) & IS_CONSTANT_TYPE_MASK ) == IS_CONSTANT ||
1028
+ (Z_TYPE_PP (pp ) & IS_CONSTANT_TYPE_MASK ) == IS_CONSTANT_ARRAY ) {
1029
+ zend_class_entry * * scope = EG (in_execution )?& EG (scope ):& CG (active_class_entry );
1030
+
1031
+ if ((* scope )-> parent ) {
1032
+ zend_class_entry * ce = * scope ;
1033
+ HashPosition pos ;
1034
+ zend_property_info * prop_info ;
1035
+
1036
+ do {
1037
+ for (zend_hash_internal_pointer_reset_ex (& ce -> properties_info , & pos );
1038
+ zend_hash_get_current_data_ex (& ce -> properties_info , (void * * ) & prop_info , & pos ) == SUCCESS ;
1039
+ zend_hash_move_forward_ex (& ce -> properties_info , & pos )) {
1040
+ if (is_static == ((prop_info -> flags & ZEND_ACC_STATIC ) != 0 ) &&
1041
+ offset == prop_info -> offset ) {
1042
+ zend_class_entry * old_scope = * scope ;
1043
+ * scope = prop_info -> ce ;
1044
+ int ret = zval_update_constant (pp , (void * )1 TSRMLS_CC );
1045
+ * scope = old_scope ;
1046
+ return ret ;
1047
+ }
1048
+ }
1049
+ ce = ce -> parent ;
1050
+ } while (ce );
1051
+
1052
+ }
1053
+ return zval_update_constant (pp , (void * )1 TSRMLS_CC );
1054
+ }
1055
+ return 0 ;
1056
+ }
1057
+ /* }}} */
1058
+
1025
1059
ZEND_API void zend_update_class_constants (zend_class_entry * class_type TSRMLS_DC ) /* {{{ */
1026
1060
{
1027
1061
if ((class_type -> ce_flags & ZEND_ACC_CONSTANTS_UPDATED ) == 0 || (!CE_STATIC_MEMBERS (class_type ) && class_type -> default_static_members_count )) {
@@ -1034,7 +1068,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
1034
1068
1035
1069
for (i = 0 ; i < class_type -> default_properties_count ; i ++ ) {
1036
1070
if (class_type -> default_properties_table [i ]) {
1037
- zval_update_constant (& class_type -> default_properties_table [i ], ( void * * ) 1 TSRMLS_CC );
1071
+ zval_update_class_constant (& class_type -> default_properties_table [i ], 0 , i TSRMLS_CC );
1038
1072
}
1039
1073
}
1040
1074
@@ -1075,7 +1109,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
1075
1109
}
1076
1110
1077
1111
for (i = 0 ; i < class_type -> default_static_members_count ; i ++ ) {
1078
- zval_update_constant (& CE_STATIC_MEMBERS (class_type )[i ], ( void * * ) 1 TSRMLS_CC );
1112
+ zval_update_class_constant (& CE_STATIC_MEMBERS (class_type )[i ], 1 , i TSRMLS_CC );
1079
1113
}
1080
1114
1081
1115
* scope = old_scope ;
0 commit comments