Mantis - Quercus
Viewing Issue Advanced Details
3529 minor always 05-22-09 08:07 05-22-09 08:07
krovid  
 
normal  
new 3.2.1  
open  
none    
none  
0003529: Using the QuercusScriptEngine on command line throws a fatal error.
I was trying to run a PHP script from command line using the QuercusScriptEngine as follows:

QuercusScriptEngineFactory factory = new QuercusScriptEngineFactory();
ScriptEngine engine = factory.getScriptEngine();
String paramValue = "";
engine.put("param_name", paramValue);
String script = "<some php script>";
engine.eval(script);


I get the following error:
Exception in thread "main" com.caucho.quercus.QuercusErrorException: eval::3: Fatal Error: header requires a http context [header]
    at com.caucho.quercus.env.Env.error(Env.java:4492)
    at com.caucho.quercus.env.Env.error(Env.java:4403)
    at com.caucho.quercus.env.Env.error(Env.java:4081)
    at com.caucho.quercus.lib.HttpModule.header(HttpModule.java:77)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.caucho.quercus.module.StaticFunction.invoke(StaticFunction.java:129)
    at com.caucho.quercus.env.JavaInvoker.callMethod(JavaInvoker.java:606)
    at com.caucho.quercus.env.JavaInvoker.call(JavaInvoker.java:541)
    at com.caucho.quercus.expr.FunctionExpr.evalImpl(FunctionExpr.java:182)
    at com.caucho.quercus.expr.FunctionExpr.eval(FunctionExpr.java:126)
    at com.caucho.quercus.program.ExprStatement.execute(ExprStatement.java:64)
    at com.caucho.quercus.program.BlockStatement.execute(BlockStatement.java:105)
    at com.caucho.quercus.program.QuercusProgram.execute(QuercusProgram.java:272)
    at com.caucho.quercus.script.QuercusScriptEngine.eval(QuercusScriptEngine.java:113)
    at com.caucho.quercus.script.QuercusScriptEngine.eval(QuercusScriptEngine.java:152)
    at javax.script.AbstractScriptEngine.eval(AbstractScriptEngine.java:247)

Could you please help?

thanks.

There are no notes attached to this issue.