I cannot figure out what the problem is with the QuercusCompiledScript.eval. Running code:
QuercusScriptEngine quercusScriptEngine = new QuercusScriptEngine();
quercusScriptEngine.eval("<?php echo 'hello uncompiled!\n'; ?>");
CompiledScript script = quercusScriptEngine.compile("<?php echo 'hello compiled!\n'; ?>");
script.eval();
System.out.println("that's all");
produces:
hello uncompiled!
that's all
Debugging this stuff I could not figure out what's wrong, as it does execute the statement, buffers are OK, but the output itself is not performed.
What is wrong?
I found the cause of the problem. The
QuercusScriptEngine.eval()explicitly doeswriter.flush()in the end referring to the http://bugs.caucho.com/view.php?id=1914. But theQuercusCompiledScript.eval()does not, at least in the quercus-4.0.39 (and in the quercus-4.0.45 as well). The workaround is to flush explicitly providing aWriter: