@@ -211,21 +211,12 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
211
211
}
212
212
213
213
fcic -> called_scope = called_scope ;
214
-
215
- #if PHP_VERSION_ID >= 80000
216
214
calling_scope = zend_get_called_scope (EG (current_execute_data ));
217
- #else
218
- calling_scope = zend_get_executed_scope ();
219
- #endif
220
-
221
215
fcic -> object = this_ptr ? Z_OBJ_P (this_ptr ) : NULL ;
222
216
switch (type ) {
223
217
case zephir_fcall_parent :
224
-
225
- #if PHP_VERSION_ID >= 80000
226
218
if (ce && Z_TYPE_P (func ) == IS_STRING ) {
227
219
fcic -> function_handler = zend_hash_find_ptr (& ce -> parent -> function_table , Z_STR_P (func ));
228
-
229
220
fcic -> calling_scope = ce -> parent ;
230
221
} else if (EXPECTED (calling_scope && calling_scope -> parent )) {
231
222
if (Z_TYPE_P (func ) == IS_STRING ) {
@@ -235,7 +226,7 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
235
226
} else {
236
227
return ;
237
228
}
238
- #endif
229
+
239
230
if (UNEXPECTED (!calling_scope || !calling_scope -> parent )) {
240
231
return ;
241
232
}
@@ -244,25 +235,17 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
244
235
break ;
245
236
246
237
case zephir_fcall_static :
247
- #if PHP_VERSION_ID >= 80000
248
238
if (ce && Z_TYPE_P (func ) == IS_STRING ) {
249
239
fcic -> function_handler = zend_hash_find_ptr (& ce -> function_table , Z_STR_P (func ));
250
240
fcic -> calling_scope = ce ;
251
241
} else if (calling_scope && Z_TYPE_P (func ) == IS_STRING ) {
252
242
fcic -> function_handler = zend_hash_find_ptr (& calling_scope -> function_table , Z_STR_P (func ));
253
243
fcic -> calling_scope = called_scope ;
254
244
}
255
- #else
256
- fcic -> calling_scope = called_scope ;
257
- if (UNEXPECTED (!calling_scope )) {
258
- return ;
259
- }
260
- #endif
261
245
262
246
break ;
263
247
264
248
case zephir_fcall_self :
265
- #if PHP_VERSION_ID >= 80000
266
249
if (ce && Z_TYPE_P (func ) == IS_STRING ) {
267
250
fcic -> function_handler = zend_hash_find_ptr (& ce -> function_table , Z_STR_P (func ));
268
251
fcic -> calling_scope = ce ;
@@ -273,13 +256,9 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
273
256
//fcic->called_scope = zend_get_called_scope(EG(current_execute_data));
274
257
fcic -> calling_scope = calling_scope ;
275
258
}
276
- #else
277
- fcic -> calling_scope = calling_scope ;
278
- #endif
279
259
break ;
280
260
281
261
case zephir_fcall_ce :
282
- #if PHP_VERSION_ID >= 80000
283
262
if (ce && Z_TYPE_P (func ) == IS_STRING ) {
284
263
fcic -> function_handler = zend_hash_find_ptr (& ce -> function_table , Z_STR_P (func ));
285
264
@@ -288,7 +267,6 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
288
267
fcic -> function_handler = zend_hash_find_ptr (& calling_scope -> function_table , Z_STR_P (func ));
289
268
fcic -> calling_scope = calling_scope ;
290
269
}
291
- #endif
292
270
// TODO: Check for PHP 7.4 and PHP 8.0, as it rewrite from above
293
271
fcic -> calling_scope = ce ;
294
272
fcic -> called_scope = ce ;
@@ -297,23 +275,17 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
297
275
case zephir_fcall_function :
298
276
case zephir_fcall_method :
299
277
if (Z_TYPE_P (func ) == IS_OBJECT ) {
300
- #if PHP_VERSION_ID >= 80000
301
278
if (Z_OBJ_HANDLER_P (func , get_closure ) && Z_OBJ_HANDLER_P (func , get_closure )(Z_OBJ_P (func ), & fcic -> calling_scope , & fcic -> function_handler , & fcic -> object , 0 ) == SUCCESS ) {
302
- #else
303
- if (Z_OBJ_HANDLER_P (func , get_closure ) && Z_OBJ_HANDLER_P (func , get_closure )(func , & fcic -> calling_scope , & fcic -> function_handler , & fcic -> object ) == SUCCESS ) {
304
- #endif
305
279
fcic -> called_scope = fcic -> calling_scope ;
306
280
break ;
307
281
}
308
282
309
283
return ;
310
284
}
311
285
312
- #if PHP_VERSION_ID >= 80000
313
286
if (ce && Z_TYPE_P (func ) == IS_STRING ) {
314
287
fcic -> function_handler = zend_hash_find_ptr (& ce -> function_table , Z_STR_P (func ));
315
288
}
316
- #endif
317
289
fcic -> calling_scope = this_ptr ? Z_OBJCE_P (this_ptr ) : NULL ;
318
290
fcic -> called_scope = fcic -> calling_scope ;
319
291
break ;
@@ -383,12 +355,7 @@ int zephir_call_user_function(
383
355
ZVAL_COPY_VALUE (& fci .function_name , function_name );
384
356
fci .retval = retval_ptr ? retval_ptr : & local_retval_ptr ;
385
357
fci .param_count = param_count ;
386
-
387
- #if PHP_VERSION_ID < 80000
388
- fci .no_separation = 1 ;
389
- #else
390
358
fci .named_params = NULL ;
391
- #endif
392
359
393
360
if (cache_entry && * cache_entry ) {
394
361
/* We have a cache record, initialize scope */
@@ -402,22 +369,22 @@ int zephir_call_user_function(
402
369
/* The caller is interested in caching OR we have the call cache enabled */
403
370
resolve_callable (& callable , type , (object_pp && type != zephir_fcall_ce ? Z_OBJCE_P (object_pp ) : obj_ce ), object_pp , function_name );
404
371
405
- #if PHP_VERSION_ID >= 80000
406
- char * is_callable_error = NULL ;
407
- zend_execute_data * frame = EG (current_execute_data );
372
+ char * is_callable_error = NULL ;
373
+ zend_execute_data * frame = EG (current_execute_data );
374
+ #if PHP_VERSION_ID >= 80200
375
+ if (obj_ce || !zend_is_callable_at_frame (& callable , fci .object , frame , IS_CALLABLE_SUPPRESS_DEPRECATIONS , & fcic , & is_callable_error )) {
376
+ #else
408
377
if (obj_ce || !zend_is_callable_at_frame (& callable , fci .object , frame , 0 , & fcic , & is_callable_error )) {
409
- if (is_callable_error ) {
410
- zend_error (E_WARNING , "%s" , is_callable_error );
411
- efree (is_callable_error );
378
+ #endif
379
+ if (is_callable_error ) {
380
+ zend_error (E_WARNING , "%s" , is_callable_error );
381
+ efree (is_callable_error );
412
382
413
- return FAILURE ;
414
- }
383
+ return FAILURE ;
384
+ }
415
385
416
386
populate_fcic (& fcic , type , obj_ce , object_pp , function_name , called_scope );
417
387
}
418
- #else
419
- zend_is_callable_ex (& callable , fci .object , IS_CALLABLE_CHECK_SILENT , NULL , & fcic , NULL );
420
- #endif
421
388
}
422
389
423
390
#ifdef _MSC_VER
@@ -432,12 +399,9 @@ int zephir_call_user_function(
432
399
}
433
400
434
401
fci .params = p ;
435
-
436
- #if PHP_VERSION_ID >= 80000
437
402
if (!fcic .function_handler ) {
438
403
ZVAL_COPY_VALUE (& fci .function_name , & callable );
439
404
}
440
- #endif
441
405
442
406
status = zend_call_function (& fci , & fcic );
443
407
@@ -630,31 +594,12 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa
630
594
return FAILURE ;
631
595
}
632
596
633
- #if PHP_VERSION_ID < 80000
634
- zend_fcall_info_init (handler , 0 , & fci , & fci_cache , NULL , & is_callable_error );
635
-
636
- if (is_callable_error ) {
637
- zend_error (E_WARNING , "%s" , is_callable_error );
638
- efree (is_callable_error );
639
- } else {
640
- status = SUCCESS ;
641
- }
642
-
643
- if (status == SUCCESS ) {
644
- zend_fcall_info_args (& fci , params );
645
-
646
- fci .retval = return_value ;
647
- zend_call_function (& fci , & fci_cache );
648
-
649
- zend_fcall_info_args_clear (& fci , 1 );
650
- }
651
-
652
- if (EG (exception )) {
653
- status = SUCCESS ;
654
- }
655
- #else
656
597
zend_execute_data * frame = EG (current_execute_data );
598
+ #if PHP_VERSION_ID >= 80200
599
+ if (!zend_is_callable_at_frame (handler , NULL , frame , IS_CALLABLE_SUPPRESS_DEPRECATIONS , & fci_cache , & is_callable_error )) {
600
+ #else
657
601
if (!zend_is_callable_at_frame (handler , NULL , frame , 0 , & fci_cache , & is_callable_error )) {
602
+ #endif
658
603
if (is_callable_error ) {
659
604
zend_error (E_WARNING , "%s" , is_callable_error );
660
605
efree (is_callable_error );
@@ -674,7 +619,6 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa
674
619
zend_fcall_info_args (& fci , params );
675
620
status = zend_call_function (& fci , & fci_cache );
676
621
zend_fcall_info_args_clear (& fci , 1 );
677
- #endif
678
622
679
623
return status ;
680
624
}
@@ -696,11 +640,7 @@ void zephir_eval_php(zval *str, zval *retval_ptr, char *context)
696
640
#if PHP_VERSION_ID >= 80200
697
641
new_op_array = zend_compile_string (Z_STR_P (str ), context , ZEND_COMPILE_POSITION_AFTER_OPEN_TAG );
698
642
#else
699
- #if PHP_VERSION_ID >= 80000
700
643
new_op_array = zend_compile_string (Z_STR_P (str ), context );
701
- #else
702
- new_op_array = zend_compile_string (str , context );
703
- #endif
704
644
#endif
705
645
706
646
CG (compiler_options ) = original_compiler_options ;
0 commit comments