@@ -7570,6 +7570,7 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
7570
7570
bool is_ref = (param_ast -> attr & ZEND_PARAM_REF ) != 0 ;
7571
7571
bool is_variadic = (param_ast -> attr & ZEND_PARAM_VARIADIC ) != 0 ;
7572
7572
uint32_t property_flags = param_ast -> attr & (ZEND_ACC_PPP_MASK | ZEND_ACC_READONLY );
7573
+ bool is_promoted = property_flags || hooks_ast ;
7573
7574
7574
7575
znode var_node , default_node ;
7575
7576
uint8_t opcode ;
@@ -7626,14 +7627,14 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
7626
7627
if (attributes_ast ) {
7627
7628
zend_compile_attributes (
7628
7629
& op_array -> attributes , attributes_ast , i + 1 , ZEND_ATTRIBUTE_TARGET_PARAMETER ,
7629
- property_flags ? ZEND_ATTRIBUTE_TARGET_PROPERTY : 0
7630
+ is_promoted ? ZEND_ATTRIBUTE_TARGET_PROPERTY : 0
7630
7631
);
7631
7632
}
7632
7633
7633
7634
bool forced_allow_nullable = false;
7634
7635
if (type_ast ) {
7635
7636
uint32_t default_type = * default_ast_ptr ? Z_TYPE (default_node .u .constant ) : IS_UNDEF ;
7636
- bool force_nullable = default_type == IS_NULL && !property_flags ;
7637
+ bool force_nullable = default_type == IS_NULL && !is_promoted ;
7637
7638
7638
7639
op_array -> fn_flags |= ZEND_ACC_HAS_TYPE_HINTS ;
7639
7640
arg_info -> type = zend_compile_typename_ex (type_ast , force_nullable , & forced_allow_nullable );
@@ -7696,14 +7697,14 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
7696
7697
}
7697
7698
7698
7699
uint32_t arg_info_flags = _ZEND_ARG_INFO_FLAGS (is_ref , is_variadic , /* is_tentative */ 0 )
7699
- | (property_flags ? _ZEND_IS_PROMOTED_BIT : 0 );
7700
+ | (is_promoted ? _ZEND_IS_PROMOTED_BIT : 0 );
7700
7701
ZEND_TYPE_FULL_MASK (arg_info -> type ) |= arg_info_flags ;
7701
7702
if (opcode == ZEND_RECV ) {
7702
7703
opline -> op2 .num = type_ast ?
7703
7704
ZEND_TYPE_FULL_MASK (arg_info -> type ) : MAY_BE_ANY ;
7704
7705
}
7705
7706
7706
- if (property_flags ) {
7707
+ if (is_promoted ) {
7707
7708
zend_op_array * op_array = CG (active_op_array );
7708
7709
zend_class_entry * scope = op_array -> scope ;
7709
7710
@@ -7790,9 +7791,11 @@ static void zend_compile_params(zend_ast *ast, zend_ast *return_type_ast, uint32
7790
7791
7791
7792
for (i = 0 ; i < list -> children ; i ++ ) {
7792
7793
zend_ast * param_ast = list -> child [i ];
7794
+ zend_ast * hooks_ast = param_ast -> child [5 ];
7793
7795
bool is_ref = (param_ast -> attr & ZEND_PARAM_REF ) != 0 ;
7794
7796
uint32_t flags = param_ast -> attr & (ZEND_ACC_PPP_MASK | ZEND_ACC_READONLY );
7795
- if (!flags ) {
7797
+ bool is_promoted = flags || hooks_ast ;
7798
+ if (!is_promoted ) {
7796
7799
continue ;
7797
7800
}
7798
7801
@@ -8543,6 +8546,10 @@ static void zend_compile_property_hooks(
8543
8546
/* Will be removed again, in case of Iterator or IteratorAggregate. */
8544
8547
ce -> get_iterator = zend_hooked_object_get_iterator ;
8545
8548
}
8549
+
8550
+ if (!prop_info -> ce -> parent_name ) {
8551
+ zend_verify_hooked_property (ce , prop_info , prop_name );
8552
+ }
8546
8553
}
8547
8554
8548
8555
static void zend_compile_prop_decl (zend_ast * ast , zend_ast * type_ast , uint32_t flags , zend_ast * attr_ast ) /* {{{ */
@@ -8679,10 +8686,6 @@ static void zend_compile_prop_decl(zend_ast *ast, zend_ast *type_ast, uint32_t f
8679
8686
8680
8687
if (hooks_ast ) {
8681
8688
zend_compile_property_hooks (info , name , type_ast , zend_ast_get_list (hooks_ast ));
8682
-
8683
- if (!ce -> parent_name ) {
8684
- zend_verify_hooked_property (ce , info , name );
8685
- }
8686
8689
}
8687
8690
8688
8691
if (attr_ast ) {
0 commit comments