Previously, Context.Eval relied on Zend's zend_eval_script function for executing arbitrary strings. Unfortunately, the above contains a curious bit of functionality where the string passed is prepended with a return statement depending on whether or not a zval is passed for writing the return value.
This, of course breaks all but the simplest scripts, as we always write the return value to a zval (whether the user calling Context.Eval is to use the return value is another matter entirely).
This commit changes the implementation to a more direct (and therefore more controllable) approach. Some tests have been changed to cover this bug.
Previously,
Context.Eval
relied on Zend'szend_eval_script
function for executing arbitrary strings. Unfortunately, the above contains a curious bit of functionality where the string passed is prepended with areturn
statement depending on whether or not a zval is passed for writing the return value.This, of course breaks all but the simplest scripts, as we always write the return value to a zval (whether the user calling
Context.Eval
is to use the return value is another matter entirely).This commit changes the implementation to a more direct (and therefore more controllable) approach. Some tests have been changed to cover this bug.