@@ -211,21 +211,12 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
211211 }
212212
213213 fcic -> called_scope = called_scope ;
214-
215- #if PHP_VERSION_ID >= 80000
216214 calling_scope = zend_get_called_scope (EG (current_execute_data ));
217- #else
218- calling_scope = zend_get_executed_scope ();
219- #endif
220-
221215 fcic -> object = this_ptr ? Z_OBJ_P (this_ptr ) : NULL ;
222216 switch (type ) {
223217 case zephir_fcall_parent :
224-
225- #if PHP_VERSION_ID >= 80000
226218 if (ce && Z_TYPE_P (func ) == IS_STRING ) {
227219 fcic -> function_handler = zend_hash_find_ptr (& ce -> parent -> function_table , Z_STR_P (func ));
228-
229220 fcic -> calling_scope = ce -> parent ;
230221 } else if (EXPECTED (calling_scope && calling_scope -> parent )) {
231222 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
235226 } else {
236227 return ;
237228 }
238- #endif
229+
239230 if (UNEXPECTED (!calling_scope || !calling_scope -> parent )) {
240231 return ;
241232 }
@@ -244,25 +235,17 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
244235 break ;
245236
246237 case zephir_fcall_static :
247- #if PHP_VERSION_ID >= 80000
248238 if (ce && Z_TYPE_P (func ) == IS_STRING ) {
249239 fcic -> function_handler = zend_hash_find_ptr (& ce -> function_table , Z_STR_P (func ));
250240 fcic -> calling_scope = ce ;
251241 } else if (calling_scope && Z_TYPE_P (func ) == IS_STRING ) {
252242 fcic -> function_handler = zend_hash_find_ptr (& calling_scope -> function_table , Z_STR_P (func ));
253243 fcic -> calling_scope = called_scope ;
254244 }
255- #else
256- fcic -> calling_scope = called_scope ;
257- if (UNEXPECTED (!calling_scope )) {
258- return ;
259- }
260- #endif
261245
262246 break ;
263247
264248 case zephir_fcall_self :
265- #if PHP_VERSION_ID >= 80000
266249 if (ce && Z_TYPE_P (func ) == IS_STRING ) {
267250 fcic -> function_handler = zend_hash_find_ptr (& ce -> function_table , Z_STR_P (func ));
268251 fcic -> calling_scope = ce ;
@@ -273,13 +256,9 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
273256 //fcic->called_scope = zend_get_called_scope(EG(current_execute_data));
274257 fcic -> calling_scope = calling_scope ;
275258 }
276- #else
277- fcic -> calling_scope = calling_scope ;
278- #endif
279259 break ;
280260
281261 case zephir_fcall_ce :
282- #if PHP_VERSION_ID >= 80000
283262 if (ce && Z_TYPE_P (func ) == IS_STRING ) {
284263 fcic -> function_handler = zend_hash_find_ptr (& ce -> function_table , Z_STR_P (func ));
285264
@@ -288,7 +267,6 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
288267 fcic -> function_handler = zend_hash_find_ptr (& calling_scope -> function_table , Z_STR_P (func ));
289268 fcic -> calling_scope = calling_scope ;
290269 }
291- #endif
292270 // TODO: Check for PHP 7.4 and PHP 8.0, as it rewrite from above
293271 fcic -> calling_scope = ce ;
294272 fcic -> called_scope = ce ;
@@ -297,23 +275,17 @@ static void populate_fcic(zend_fcall_info_cache* fcic, zephir_call_type type, ze
297275 case zephir_fcall_function :
298276 case zephir_fcall_method :
299277 if (Z_TYPE_P (func ) == IS_OBJECT ) {
300- #if PHP_VERSION_ID >= 80000
301278 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
305279 fcic -> called_scope = fcic -> calling_scope ;
306280 break ;
307281 }
308282
309283 return ;
310284 }
311285
312- #if PHP_VERSION_ID >= 80000
313286 if (ce && Z_TYPE_P (func ) == IS_STRING ) {
314287 fcic -> function_handler = zend_hash_find_ptr (& ce -> function_table , Z_STR_P (func ));
315288 }
316- #endif
317289 fcic -> calling_scope = this_ptr ? Z_OBJCE_P (this_ptr ) : NULL ;
318290 fcic -> called_scope = fcic -> calling_scope ;
319291 break ;
@@ -383,12 +355,7 @@ int zephir_call_user_function(
383355 ZVAL_COPY_VALUE (& fci .function_name , function_name );
384356 fci .retval = retval_ptr ? retval_ptr : & local_retval_ptr ;
385357 fci .param_count = param_count ;
386-
387- #if PHP_VERSION_ID < 80000
388- fci .no_separation = 1 ;
389- #else
390358 fci .named_params = NULL ;
391- #endif
392359
393360 if (cache_entry && * cache_entry ) {
394361 /* We have a cache record, initialize scope */
@@ -402,22 +369,22 @@ int zephir_call_user_function(
402369 /* The caller is interested in caching OR we have the call cache enabled */
403370 resolve_callable (& callable , type , (object_pp && type != zephir_fcall_ce ? Z_OBJCE_P (object_pp ) : obj_ce ), object_pp , function_name );
404371
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
408377 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 );
412382
413- return FAILURE ;
414- }
383+ return FAILURE ;
384+ }
415385
416386 populate_fcic (& fcic , type , obj_ce , object_pp , function_name , called_scope );
417387 }
418- #else
419- zend_is_callable_ex (& callable , fci .object , IS_CALLABLE_CHECK_SILENT , NULL , & fcic , NULL );
420- #endif
421388 }
422389
423390#ifdef _MSC_VER
@@ -432,12 +399,9 @@ int zephir_call_user_function(
432399 }
433400
434401 fci .params = p ;
435-
436- #if PHP_VERSION_ID >= 80000
437402 if (!fcic .function_handler ) {
438403 ZVAL_COPY_VALUE (& fci .function_name , & callable );
439404 }
440- #endif
441405
442406 status = zend_call_function (& fci , & fcic );
443407
@@ -630,31 +594,12 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa
630594 return FAILURE ;
631595 }
632596
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
656597 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
657601 if (!zend_is_callable_at_frame (handler , NULL , frame , 0 , & fci_cache , & is_callable_error )) {
602+ #endif
658603 if (is_callable_error ) {
659604 zend_error (E_WARNING , "%s" , is_callable_error );
660605 efree (is_callable_error );
@@ -674,7 +619,6 @@ int zephir_call_user_func_array_noex(zval *return_value, zval *handler, zval *pa
674619 zend_fcall_info_args (& fci , params );
675620 status = zend_call_function (& fci , & fci_cache );
676621 zend_fcall_info_args_clear (& fci , 1 );
677- #endif
678622
679623 return status ;
680624}
@@ -696,11 +640,7 @@ void zephir_eval_php(zval *str, zval *retval_ptr, char *context)
696640#if PHP_VERSION_ID >= 80200
697641 new_op_array = zend_compile_string (Z_STR_P (str ), context , ZEND_COMPILE_POSITION_AFTER_OPEN_TAG );
698642#else
699- #if PHP_VERSION_ID >= 80000
700643 new_op_array = zend_compile_string (Z_STR_P (str ), context );
701- #else
702- new_op_array = zend_compile_string (str , context );
703- #endif
704644#endif
705645
706646 CG (compiler_options ) = original_compiler_options ;
0 commit comments