On Tue, Feb 7, 2012 at 1:47 AM, Stas Malyshev <[email protected]> wrote:
> Hi!
>
>
>> there comes a new bug relate to this change, #60978, in php_cli.c
>
>
> I'm not sure this bug is critical enough to keep messing with the code base
> this close to the release. Could you please describe what is the current
> status, what was before the fix and what exactly the problems are here?
Hi Stats,
let me try to describe the whole thing. before any change. the
php -r implemented like:
exit_code = 0;
zend_try {
if ( zend_eval_stringl() == FAILUE) { [1]
exit_code = 254; [2]
}
} zend_end_try();
if (!exit_code) {
exit_code = EG(exit_code); [3]
}
in zend_eval_stringl:
op_array = compile(*); [4]
zend_execute(op_array); [5]
free(op_array);
return SUCCESS;
then there comes a bug, if longjmp(via die, exit or zend_bailout
directly) called in [5] (zend_execute), the [4] (op_array) will be
leaked. so dsp change the zend_eval_stringl to:
op_array = compile(**);
zend_try {
zend_execute(op_array);
} zend_end_try();
free(op_array);
return SUCCESS;
then Derick found this make his xdebug code won't works any more. in
xdebug, it expect zend_eval_stringl longjmp when error occurred. but
after dsp's fix, obviously, zend_eval_stringl will not jmp anymore.
so Derick change the codes to :
op_array = compile(**);
retval = SUCCESS;
zend_try {
zend_execute(op_array);
} zend_catch {
retval = FAILURE; [6]
} zend_end_try();
free(op_array);
return retval;
let look at [1], before any change, a call to exit(or die) in a
eval string, will let the process goto [3], then make the exit_code
eqaul to EG(exit_code).
after Derick's fix [6], a call to exit(or die) in a eval string
will lead the process goto [2], which cause the exit_code always be
254 [2].
so I proposal change the fix to:
op_array = compile(**);
zend_try {
zend_execute(op_array);
} zend_catch {
free(op_array);
zend_bailout();
} zend_end_try();
free(op_array);
return SUCCESS;
this change should can meet all the needs... and won't break any BCs.
do I describe this clearly ?
thanks
> --
> Stanislav Malyshev, Software Architect
> SugarCRM: http://www.sugarcrm.com/
> (408)454-6900 ext. 227
--
Laruence Xinchen Hui
http://www.laruence.com/
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php