@@ -3770,6 +3770,8 @@ ZEND_VM_HOT_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST, NUM|CACHE_SLOT)
3770
3770
}
3771
3771
CACHE_PTR (opline -> result .num , fbc );
3772
3772
}
3773
+
3774
+ ZEND_ASSERT (fbc != (zend_function * )& zend_pass_function );
3773
3775
call = _zend_vm_stack_push_call_frame (ZEND_CALL_NESTED_FUNCTION ,
3774
3776
fbc , opline -> extended_value , NULL );
3775
3777
call -> prev_execute_data = EX (call );
@@ -3885,6 +3887,7 @@ ZEND_VM_HANDLER(118, ZEND_INIT_USER_CALL, CONST, CONST|TMPVAR|CV, NUM)
3885
3887
HANDLE_EXCEPTION ();
3886
3888
}
3887
3889
3890
+ ZEND_ASSERT (func != (zend_function * )& zend_pass_function );
3888
3891
call = zend_vm_stack_push_call_frame (call_info ,
3889
3892
func , opline -> extended_value , object_or_called_scope );
3890
3893
call -> prev_execute_data = EX (call );
@@ -3917,18 +3920,27 @@ ZEND_VM_HOT_HANDLER(69, ZEND_INIT_NS_FCALL_BY_NAME, ANY, CONST, NUM|CACHE_SLOT)
3917
3920
}
3918
3921
ZEND_VM_DISPATCH_TO_HELPER (zend_undefined_function_helper );
3919
3922
}
3920
- /* We bind the unqualified name to the global function
3923
+ /* We bind the unqualified name to the internal "zend_pass_function" for it to indicate that it
3924
+ * should use the global function.
3921
3925
* Use the lowercase name of the function stored in the first cache slot as
3922
3926
* function names are case insensitive */
3923
3927
else {
3924
3928
zval tmp ;
3925
3929
ZVAL_STR (& tmp , Z_STR_P (function_name + 1 ));
3926
- do_bind_function (fbc , & tmp );
3930
+ do_bind_function (( zend_function * ) & zend_pass_function , & tmp );
3927
3931
}
3932
+ } else if (fbc == (zend_function * ) & zend_pass_function ) {
3933
+ /* Unqualified call was marked as using the global function
3934
+ * Thus we need to replace the pass function with the actual function.
3935
+ * Use the lowercase name of the function without tha namespace which is stored in the second cache slot */
3936
+ fbc = (zend_function * ) zend_hash_find_ptr (EG (function_table ), Z_STR_P (function_name + 2 ));
3937
+ ZEND_ASSERT (fbc );
3928
3938
}
3929
3939
if (EXPECTED (fbc -> type == ZEND_USER_FUNCTION ) && UNEXPECTED (!RUN_TIME_CACHE (& fbc -> op_array ))) {
3930
3940
init_func_run_time_cache (& fbc -> op_array );
3931
3941
}
3942
+
3943
+ ZEND_ASSERT (fbc != (zend_function * )& zend_pass_function );
3932
3944
CACHE_PTR (opline -> result .num , fbc );
3933
3945
}
3934
3946
@@ -3958,6 +3970,7 @@ ZEND_VM_HOT_HANDLER(61, ZEND_INIT_FCALL, NUM, CONST, NUM|CACHE_SLOT)
3958
3970
CACHE_PTR (opline -> result .num , fbc );
3959
3971
}
3960
3972
3973
+ ZEND_ASSERT (fbc != (zend_function * )& zend_pass_function );
3961
3974
call = _zend_vm_stack_push_call_frame_ex (
3962
3975
opline -> op1 .num , ZEND_CALL_NESTED_FUNCTION ,
3963
3976
fbc , opline -> extended_value , NULL );
0 commit comments