public static Memory call(Environment env, TraceInfo trace, FunctionEntity function, Memory[] args)
            throws Throwable {
        Memory result = function.getImmutableResultTyped(env, trace);

        Memory[] passed = null;

        if (result != null && !function.hasParameters() && args == null) {
            return result;
        }

        passed = InvokeArgumentHelper.makeArguments(
                env, args, function.getParameters(), function.getName(), null, null, trace
        );

        if (result != null) {
            return result;
        }

        CallStack callStack = trace != null && function.isUsesStackTrace() ? env.getCallStack() : null;

        if (callStack != null) {
            callStack.push(trace, null, args, function.getName(), (String) null, (String) null);
        }

        try {
            result = function.invoke(env, trace, passed);
        } finally {
            if (callStack != null) {
                callStack.pop();
            }
        }

        return result;
    }
Method is invoked via bytecode

@throws Throwable
jphp-runtime/src/php/runtime/invoke/InvokeHelper.java