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

 ID:                 64248
 User updated by:    bobwei9 at hotmail dot com
 Reported by:        bobwei9 at hotmail dot com
 Summary:            Strange parse error when using language construct in
                     for
 Status:             Open
 Type:               Bug
 Package:            Scripting Engine problem
 Operating System:   Irrelevant (OS X 10.8)
 PHP Version:        master-Git-2013-02-19 (Git)
 Block user comment: N
 Private report:     N

 New Comment:

Oops, the expected result should be a notice and $max should be 'A' in the test 
script...


Previous Comments:
------------------------------------------------------------------------
[2013-02-19 21:03:57] bobwei9 at hotmail dot com

Description:
------------
For example unsetting a var in the third part of a for-loop throws an E_PARSE 
error.

Test script:
---------------
php -r '
$A = [1];
$B = [1,7];
$max = 'B';
for ($i='A'; ++$i<$max; unset($$i))
var_dump($$i);'


Expected result:
----------------
array(1) {
  [0]=>
  int(1)
}
array(2) {
  [0]=>
  int(1)
  [1]=>
  int(7)
}

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


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



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

Reply via email to