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