@@ -1051,6 +1051,40 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
1051
1051
}
1052
1052
/* }}} */
1053
1053
1054
+ static int zval_update_class_constant (zval * * pp , int is_static , int offset TSRMLS_DC ) /* {{{ */
1055
+ {
1056
+ if ((Z_TYPE_PP (pp ) & IS_CONSTANT_TYPE_MASK ) == IS_CONSTANT ||
1057
+ (Z_TYPE_PP (pp ) & IS_CONSTANT_TYPE_MASK ) == IS_CONSTANT_ARRAY ) {
1058
+ zend_class_entry * * scope = EG (in_execution )?& EG (scope ):& CG (active_class_entry );
1059
+
1060
+ if ((* scope )-> parent ) {
1061
+ zend_class_entry * ce = * scope ;
1062
+ HashPosition pos ;
1063
+ zend_property_info * prop_info ;
1064
+
1065
+ do {
1066
+ for (zend_hash_internal_pointer_reset_ex (& ce -> properties_info , & pos );
1067
+ zend_hash_get_current_data_ex (& ce -> properties_info , (void * * ) & prop_info , & pos ) == SUCCESS ;
1068
+ zend_hash_move_forward_ex (& ce -> properties_info , & pos )) {
1069
+ if (is_static == ((prop_info -> flags & ZEND_ACC_STATIC ) != 0 ) &&
1070
+ offset == prop_info -> offset ) {
1071
+ zend_class_entry * old_scope = * scope ;
1072
+ * scope = prop_info -> ce ;
1073
+ int ret = zval_update_constant (pp , (void * )1 TSRMLS_CC );
1074
+ * scope = old_scope ;
1075
+ return ret ;
1076
+ }
1077
+ }
1078
+ ce = ce -> parent ;
1079
+ } while (ce );
1080
+
1081
+ }
1082
+ return zval_update_constant (pp , (void * )1 TSRMLS_CC );
1083
+ }
1084
+ return 0 ;
1085
+ }
1086
+ /* }}} */
1087
+
1054
1088
ZEND_API void zend_update_class_constants (zend_class_entry * class_type TSRMLS_DC ) /* {{{ */
1055
1089
{
1056
1090
if ((class_type -> ce_flags & ZEND_ACC_CONSTANTS_UPDATED ) == 0 || (!CE_STATIC_MEMBERS (class_type ) && class_type -> default_static_members_count )) {
@@ -1063,7 +1097,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
1063
1097
1064
1098
for (i = 0 ; i < class_type -> default_properties_count ; i ++ ) {
1065
1099
if (class_type -> default_properties_table [i ]) {
1066
- zval_update_constant (& class_type -> default_properties_table [i ], ( void * * ) 1 TSRMLS_CC );
1100
+ zval_update_class_constant (& class_type -> default_properties_table [i ], 0 , i TSRMLS_CC );
1067
1101
}
1068
1102
}
1069
1103
@@ -1104,7 +1138,7 @@ ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC
1104
1138
}
1105
1139
1106
1140
for (i = 0 ; i < class_type -> default_static_members_count ; i ++ ) {
1107
- zval_update_constant (& CE_STATIC_MEMBERS (class_type )[i ], ( void * * ) 1 TSRMLS_CC );
1141
+ zval_update_class_constant (& CE_STATIC_MEMBERS (class_type )[i ], 1 , i TSRMLS_CC );
1108
1142
}
1109
1143
1110
1144
* scope = old_scope ;
0 commit comments