RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_language_parser.y
| From: | Andi Gutmans | Date: | Tue, 06 Mar 2007 02:54:13 +0000 |
| Subject: | RE: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_language_parser.y | ||
| References: | 1 | Groups: | php.doc php.zend-engine.cvs |
| Request: | Send a blank email to phpdoc+get-969375739@lists.php.net to get a copy of this message | ||
Did we agree on this? I don't remember we concluded this discussion.
In any case, are you sure there's not a double free bug here? (Using $1
twice?). While I haven't validated this, it seems to be buggy just by
looking at it.
Andi
> -----Original Message-----
> From: Marcus Boerger [mailto:helly@php.net]
> Sent: Sunday, March 04, 2007 8:26 AM
> To: zend-engine-cvs@lists.php.net; phpdoc@lists.php.net
> Subject: [ZEND-ENGINE-CVS] cvs: ZendEngine2 / zend_language_parser.y
>
> helly Sun Mar 4 16:25:58 2007 UTC
>
> Modified files:
> /ZendEngine2 zend_language_parser.y
> Log:
> - Implement '?:'
> [DOC] "expr1 ?: expr1" is a shortcut for: "expr1 ? expr1 : expr2" as
> exists in gcc and discussed some time back. Note that
> this is not
> an implementation ifsetor($var, default). While
> ifsetor would not
> generate any message for non existing variables or
> array indices
> the ternary shortcut does. Also the ternary shortcut
> does a boolean
> evaluation rather then checking for isset(). That way
> ther ternary
> shortcut can work on any expression while ifsetor can
> only work on
> variables. Also to be silent one has do do: "@$expr1
> ?: $expr2".
>
>
> http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_language_parser
> .y?r1=1.178&r2=1.179&diff_format=u
> Index: ZendEngine2/zend_language_parser.y
> diff -u ZendEngine2/zend_language_parser.y:1.178
> ZendEngine2/zend_language_parser.y:1.179
> --- ZendEngine2/zend_language_parser.y:1.178 Mon Jan 29 04:40:46 2007
> +++ ZendEngine2/zend_language_parser.y Sun Mar 4 16:25:57 2007
> @@ -18,7 +18,7 @@
>
> +-------------------------------------------------------------
> ---------+
> */
>
> -/* $Id: zend_language_parser.y,v 1.178 2007/01/29 04:40:46
> iliaa Exp $ */
> +/* $Id: zend_language_parser.y,v 1.179 2007/03/04 16:25:57
> helly Exp $
> +*/
>
> /*
> * LALR shift/reduce conflicts and how they are resolved:
> @@ -611,6 +611,9 @@
> | expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); }
> expr ':' { zend_do_qm_true(&$4, &$2, &$5 TSRMLS_CC); }
> expr { zend_do_qm_false(&$$, &$7, &$2, &$5
> TSRMLS_CC); }
> + | expr '?' { zend_do_begin_qm_op(&$1, &$2 TSRMLS_CC); }
> + ':' { zend_do_qm_true(&$1, &$2, &$4 TSRMLS_CC); }
> + expr { zend_do_qm_false(&$$, &$6, &$2, &$4
> TSRMLS_CC); }
> | internal_functions_in_yacc { $$ = $1; }
> | T_INT_CAST expr { zend_do_cast(&$$,
> &$2, IS_LONG TSRMLS_CC); }
> | T_DOUBLE_CAST expr { zend_do_cast(&$$,
> &$2, IS_DOUBLE TSRMLS_CC); }
>
> --
> Zend Engine CVS Mailing List (http://cvs.php.net/) To
> unsubscribe, visit: http://www.php.net/unsub.php
>
>