Req #61529 [Ver]: Make unset() an expression

From: Date: Thu, 29 Mar 2012 14:59:36 +0000
Subject: Req #61529 [Ver]: Make unset() an expression
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-168982@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61529&edit=1

 ID:                 61529
 Updated by:         laruence@php.net
 Reported by:        asserte at gmail dot com
 Summary:            Make unset() an expression
 Status:             Verified
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   Linux
 PHP Version:        5.4.1RC/5.5.0-dev
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

@nikic thinking of isset, include. :)


Previous Comments:
------------------------------------------------------------------------
[2012-03-29 14:59:27] laruence@php.net

@nikic thinking of isset, include. :)

------------------------------------------------------------------------
[2012-03-29 13:28:04] nikic@php.net

unset() is a statement, not an expression. So you obviously can't use it in an expression
context. Changing buy type to Feature Request.

In my eyes the behavior *should not* be changed. unset() does not have a meaningful return value and
as such should not be allowed in an expression context.

------------------------------------------------------------------------
[2012-03-29 13:07:36] reeze dot xia at gmail dot com

unset() is like echo These are language constuct, Both of them are not 
expression in PHP, so code like this:

$c = 1 && echo 3;

IS NOT VALID script too;

Those language construct are "unticked_statement" @see 
Zend/zend_language_parser.y.
if,switch, do while and etc they all.

So from now on, This is not a bug.

Maybe we could make unset() a normal expression. I don't know how this decision 
made, maybe we can discuss it in maillist.

------------------------------------------------------------------------
[2012-03-29 12:53:18] laruence@php.net

oh, the patch is based on trunk.

------------------------------------------------------------------------
[2012-03-29 12:51:18] laruence@php.net

The following patch has been added/updated:

Patch Name: bug61529.phpt
Revision:   1333025478
URL:        https://bugs.php.net/patch-display.php?bug=61529&patch=bug61529.phpt&revision=1333025478

------------------------------------------------------------------------


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=61529


-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61529&edit=1


Thread (15 messages)

« previous php.bugs (#168982) next »