@@ -4876,25 +4876,22 @@ static void zend_compile_static_var(zend_ast *ast) /* {{{ */
4876
4876
zend_error_noreturn (E_COMPILE_ERROR , "Cannot use $this as static variable" );
4877
4877
}
4878
4878
4879
+ if (!CG (active_op_array )-> static_variables ) {
4880
+ if (CG (active_op_array )-> scope ) {
4881
+ CG (active_op_array )-> scope -> ce_flags |= ZEND_HAS_STATIC_IN_METHODS ;
4882
+ }
4883
+ CG (active_op_array )-> static_variables = zend_new_array (8 );
4884
+ }
4885
+
4886
+ if (zend_hash_exists (CG (active_op_array )-> static_variables , var_name )) {
4887
+ zend_error_noreturn (E_COMPILE_ERROR , "Duplicate declaration of static variable $%s" , ZSTR_VAL (var_name ));
4888
+ }
4889
+
4879
4890
if (!value_ast ) {
4880
4891
zend_compile_static_var_common (var_name , & EG (uninitialized_zval ), ZEND_BIND_REF );
4881
4892
} else {
4882
4893
zend_op * opline ;
4883
4894
4884
- if (!CG (active_op_array )-> static_variables ) {
4885
- if (CG (active_op_array )-> scope ) {
4886
- CG (active_op_array )-> scope -> ce_flags |= ZEND_HAS_STATIC_IN_METHODS ;
4887
- }
4888
- CG (active_op_array )-> static_variables = zend_new_array (8 );
4889
- }
4890
-
4891
- if (zend_string_equals_literal (var_name , "this" )) {
4892
- zend_error_noreturn (E_COMPILE_ERROR , "Cannot use $this as static variable" );
4893
- }
4894
- if (zend_hash_exists (CG (active_op_array )-> static_variables , var_name )) {
4895
- zend_error_noreturn (E_COMPILE_ERROR , "Duplicate declaration of static variable $%s" , ZSTR_VAL (var_name ));
4896
- }
4897
-
4898
4895
zval * placeholder_ptr = zend_hash_update (CG (active_op_array )-> static_variables , var_name , & EG (uninitialized_zval ));
4899
4896
Z_TYPE_EXTRA_P (placeholder_ptr ) |= IS_TYPE_UNINITIALIZED ;
4900
4897
uint32_t placeholder_offset = (uint32_t )((char * )placeholder_ptr - (char * )CG (active_op_array )-> static_variables -> arData );
0 commit comments