Bug #61529 [Com]: Parsing error

2012-03-29 Thread reeze dot xia at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=61529&edit=1

 ID: 61529
 Comment by: reeze dot xia at gmail dot com
 Reported by:asserte at gmail dot com
 Summary:Parsing error
 Status: Verified
 Type:   Bug
 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:

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.


Previous Comments:

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

oh, the patch is based on trunk.


[2012-03-29 12:51:18] larue...@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


[2012-03-29 12:49:51] larue...@php.net

Dmitry, could you review my patch for this bug plz?  thanks


[2012-03-29 12:49:24] larue...@php.net

The following patch has been added/updated:

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


[2012-03-28 08:51:33] yohg...@php.net

Verified.

$ php -r '1 && unset($var["a"]);'

is enough.

--
[yohgaki@dev php-src]$ ./sapi/cli/php -v
PHP 5.5.0-dev (cli) (built: Mar 28 2012 17:33:51) (DEBUG)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

[yohgaki@dev php-src]$ ./sapi/cli/php -r 'unset($var["a"]);'
[yohgaki@dev php-src]$ ./sapi/cli/php -r '1 && unset($var["a"]);'

Parse error: syntax error, unexpected 'unset' (T_UNSET) in Command line code on 
line 1
--




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


Bug #61529 [Com]: Parsing error

2012-03-29 Thread larue...@php.net
Edit report at https://bugs.php.net/bug.php?id=61529&edit=1

 ID: 61529
 Comment by: larue...@php.net
 Reported by:asserte at gmail dot com
 Summary:Parsing error
 Status: Verified
 Type:   Bug
 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:

Dmitry, could you review my patch for this bug plz?  thanks


Previous Comments:

[2012-03-29 12:49:24] larue...@php.net

The following patch has been added/updated:

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


[2012-03-28 08:51:33] yohg...@php.net

Verified.

$ php -r '1 && unset($var["a"]);'

is enough.

--
[yohgaki@dev php-src]$ ./sapi/cli/php -v
PHP 5.5.0-dev (cli) (built: Mar 28 2012 17:33:51) (DEBUG)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2012 Zend Technologies

[yohgaki@dev php-src]$ ./sapi/cli/php -r 'unset($var["a"]);'
[yohgaki@dev php-src]$ ./sapi/cli/php -r '1 && unset($var["a"]);'

Parse error: syntax error, unexpected 'unset' (T_UNSET) in Command line code on 
line 1
--


[2012-03-27 13:49:14] asserte at gmail dot com

Move to SE problems


[2012-03-27 13:45:26] asserte at gmail dot com

Description:

isset() && unset()

PHP Parse error:  syntax error, unexpected 'unset' (T_UNSET), expecting ')' in 
/tmp/isset.php on line 4

Tested on PHP 5.4.0-3 (cli) (built: Mar 22 2012 07:59:57) 


Test script:
---
$> cat /tmp/isset.php
  1  1, 'name' => 'example');
  4 isset( $entity['id'] ) && unset( $entity['id'] );

$> php /tmp/isset.php
PHP Parse error:  syntax error, unexpected 'unset' (T_UNSET), expecting ')' in 
/tmp/isset.php on line 3

Expected result:

unset should works.







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