On Mon, 6 Feb 2012, Laruence wrote:

> there comes a new bug relate to this change,  #60978,   in php_cli.c
> 
>        case PHP_MODE_CLI_DIRECT:
>             cli_register_file_handles(TSRMLS_C);
>             if (zend_eval_string_ex(exec_direct, NULL, "Command line
> code", 1 TSRMLS_CC) == FAILURE) {
>                 exit_status=254;
>             }
> 
> return failure in zend_eval_stringl will cause exit_status be overrided.
> 
> and I think a appropriate way to fix these issues (memleak one, xdebug
> one, and exit code one),  is fix it in the old style way , which is :
> 
> catch -> free -> throw agian.
> 
> which I have made a patch(see blow),
> 
> what do you guys think?  and also if this patch is okey,  I will also
> ask for a permission to ci to 5.4.

This following patch looks good to me:

> Index: Zend/zend_execute_API.c
> ===================================================================
> --- Zend/zend_execute_API.c   (revision 323082)
> +++ Zend/zend_execute_API.c   (working copy)
> @@ -1195,11 +1195,12 @@
>               }
>               CG(interactive) = 0;
> 
> -             retval = SUCCESS;
>               zend_try {
>                       zend_execute(new_op_array TSRMLS_CC);
>               } zend_catch {
> -                     retval = FAILURE;
> +                     destroy_op_array(new_op_array TSRMLS_CC);
> +                     efree(new_op_array);
> +                     zend_bailout();
>               } zend_end_try();
> 
>               CG(interactive) = orig_interactive;
> @@ -1221,6 +1222,7 @@
>               destroy_op_array(new_op_array TSRMLS_CC);
>               efree(new_op_array);
>               EG(return_value_ptr_ptr) = original_return_value_ptr_ptr;
> +             retval = SUCCESS;
>       } else {
>               retval = FAILURE;
>       }

-- 
http://derickrethans.nl | http://xdebug.org
Like Xdebug? Consider a donation: http://xdebug.org/donate.php
twitter: @derickr and @xdebug

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to