Bug #65232 [Com]: error if "else" begins with a new php block
Edit report at https://bugs.php.net/bug.php?id=65232&edit=1
ID: 65232
Comment by: me at rudi dot xxx
Reported by: nayana at corp-gems dot com
Summary: error if "else" begins with a new php block
Status: Open
Type: Bug
Package: *General Issues
Operating System: Any
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
Source: http://stackoverflow.com/questions/17567868/error-if-else-begins-with-a-
new-php-block
I don't see this as an issue, though. If anything it's a good safeguard against
even worse PHP code. I would fully expect to read this that the first if block is
completed, and that the second is treated as new code entirely.
The only special context that should be retained between these open/close braces
are those that hold an active meaning - for example the contents of an if block
(anything within }).
Previous Comments:
------------------------------------------------------------------------
[2013-07-10 10:31:05] nayana at corp-gems dot com
Description:
------------
There is a parse error occurring if the "else" condition is placed in a new block.
Is this the intended behavior. I was unable to locate documentation that describes
this behavior.
<?php if (true) { ?>
Foo
<?php } ?>
<?php else { ?>
Bar
<?php } ?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=65232&edit=1
Thread (3 messages)