else if (arg.isReference()) {
map.put(arg.getName(), new EnvVarImpl(args[i].toLocalVarDeclAsRef()));
}
else {
// XXX: php/1708, toVar() may be doing another copy()
Var var = args[i].toLocalVar();
if (arg.getExpectedClass() != null
&& arg.getDefault() instanceof ParamRequiredExpr) {
env.checkTypeHint(var,
arg.getExpectedClass(),
arg.getName().toString(),
getName());
}
// quercus/0d04
map.put(arg.getName(), new EnvVarImpl(var));
}
}
for (int i = args.length; i < _args.length; i++) {
Arg arg = _args[i];
Expr defaultExpr = arg.getDefault();
if (defaultExpr == null)
return env.error("expected default expression");
else if (arg.isReference())
map.put(arg.getName(), new EnvVarImpl(defaultExpr.evalVar(env).toVar()));
else {
map.put(arg.getName(), new EnvVarImpl(defaultExpr.eval(env).toLocalVar()));
}
}
Map<StringValue,EnvVar> oldMap = env.pushEnv(map);
Value []oldArgs = env.setFunctionArgs(args);
Value oldThis;
if (_info.isMethod()) {
oldThis = env.getThis();
}
else {
// php/0967, php/091i
oldThis = env.setThis(NullThisValue.NULL);
}
try {
Value value = _statement.execute(env);
if (value == null) {
if (_isReturnsReference)
return new Var();
else
return NullValue.NULL;
}
else if (_isReturnsReference)
return value;