@@ -21,11 +21,10 @@ typedef size_t strlen_t;
21
21
# define EX_LITERAL (opline , op ) EX_CONSTANT(op)
22
22
#endif
23
23
#define SO_THIS (Z_OBJ(EX(This)) ? &EX(This) : NULL)
24
- #define FREE_OP (should_free ) \
25
- if (should_free ) { \
26
- zval_ptr_dtor_nogc(should_free ); \
24
+ #define FREE_OP (op ) \
25
+ if (opline->op##_type & (IS_TMP_VAR|IS_VAR) ) { \
26
+ zval_ptr_dtor_nogc(EX_VAR(opline->op.var) ); \
27
27
}
28
- #define FREE_OP_IF_VAR (should_free ) FREE_OP(should_free)
29
28
30
29
#define SO_EX_CV (i ) (*EX_CV_NUM(execute_data, i))
31
30
#define SO_EX_T (offset ) (*EX_TMP_VAR(execute_data, offset))
@@ -63,11 +62,15 @@ static zval *get_object_zval_ptr_safe(
63
62
64
63
static zval * get_zval_ptr_real (
65
64
const zend_op * opline , int op_type , const znode_op * node ,
66
- const zend_execute_data * execute_data , zend_free_op * should_free , int type
65
+ const zend_execute_data * execute_data , int type
67
66
) {
68
- #if PHP_VERSION_ID >= 70300
67
+ #if PHP_VERSION_ID >= 80000
68
+ zval * zv = zend_get_zval_ptr (opline , op_type , node , execute_data , type );
69
+ #elif PHP_VERSION_ID >= 70300
70
+ zend_free_op * should_free ;
69
71
zval * zv = zend_get_zval_ptr (opline , op_type , node , execute_data , should_free , type );
70
72
#else
73
+ zend_free_op * should_free ;
71
74
zval * zv = zend_get_zval_ptr (op_type , node , execute_data , should_free , type );
72
75
#endif
73
76
ZVAL_DEREF (zv );
@@ -76,17 +79,16 @@ static zval *get_zval_ptr_real(
76
79
77
80
static zval * get_object_zval_ptr_real (
78
81
const zend_op * opline , int op_type , const znode_op * node , zend_execute_data * execute_data ,
79
- zend_free_op * should_free , int type
82
+ int type
80
83
) {
81
84
if (op_type == IS_UNUSED ) {
82
85
if (!SO_THIS ) {
83
86
zend_error (E_ERROR , "Using $this when not in object context" );
84
87
}
85
88
86
- should_free = NULL ;
87
89
return SO_THIS ;
88
90
} else {
89
- return get_zval_ptr_real (opline , op_type , node , execute_data , should_free , type );
91
+ return get_zval_ptr_real (opline , op_type , node , execute_data , type );
90
92
}
91
93
}
92
94
@@ -154,6 +156,7 @@ static zend_function *scalar_objects_get_indirection_func(
154
156
ind -> fn .scope = ce ;
155
157
ind -> fn .fn_flags = ZEND_ACC_CALL_VIA_HANDLER | (fbc -> common .fn_flags & keep_flags );
156
158
ind -> fn .num_args = fbc -> common .num_args - 1 ;
159
+ ind -> fn .required_num_args = fbc -> common .required_num_args - 1 ;
157
160
158
161
ind -> fbc = fbc ;
159
162
if (fbc -> common .arg_info ) {
@@ -172,7 +175,6 @@ static zend_function *scalar_objects_get_indirection_func(
172
175
static int scalar_objects_method_call_handler (zend_execute_data * execute_data )
173
176
{
174
177
const zend_op * opline = execute_data -> opline ;
175
- zend_free_op free_op1 , free_op2 ;
176
178
zval * obj , * method ;
177
179
zend_class_entry * ce ;
178
180
zend_function * fbc ;
@@ -201,20 +203,16 @@ static int scalar_objects_method_call_handler(zend_execute_data *execute_data)
201
203
);
202
204
}
203
205
204
- method = get_zval_ptr_real (
205
- opline , opline -> op2_type , & opline -> op2 , execute_data , & free_op2 , BP_VAR_R
206
- );
207
- obj = get_object_zval_ptr_real (
208
- opline , opline -> op1_type , & opline -> op1 , execute_data , & free_op1 , BP_VAR_R
209
- );
206
+ method = get_zval_ptr_real (opline , opline -> op2_type , & opline -> op2 , execute_data , BP_VAR_R );
207
+ obj = get_object_zval_ptr_real (opline , opline -> op1_type , & opline -> op1 , execute_data , BP_VAR_R );
210
208
211
209
if (!fbc ) {
212
210
if (!EG (exception )) {
213
211
zend_throw_error (NULL , "Call to undefined method %s::%s()" ,
214
212
ZSTR_VAL (ce -> name ), Z_STRVAL_P (method ));
215
213
}
216
- FREE_OP (free_op2 );
217
- FREE_OP_IF_VAR ( free_op1 );
214
+ FREE_OP (op2 );
215
+ FREE_OP ( op1 );
218
216
return ZEND_USER_OPCODE_CONTINUE ;
219
217
}
220
218
@@ -233,8 +231,8 @@ static int scalar_objects_method_call_handler(zend_execute_data *execute_data)
233
231
EX (call ) = call ;
234
232
}
235
233
236
- FREE_OP (free_op2 );
237
- FREE_OP_IF_VAR ( free_op1 );
234
+ FREE_OP (op2 );
235
+ FREE_OP ( op1 );
238
236
239
237
execute_data -> opline ++ ;
240
238
return ZEND_USER_OPCODE_CONTINUE ;
0 commit comments