Bug #53730 [NEW]: mixed classic and new if/else/endif
| From: | max dot wildgrube at web dot de | Date: | Wed, 12 Jan 2011 19:44:37 +0000 |
| Subject: | Bug #53730 [NEW]: mixed classic and new if/else/endif | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-157865@lists.php.net to get a copy of this message | ||
From:
Operating system:
PHP version: 5.2.17
Package: *General Issues
Bug Type: Bug
Bug description:mixed classic and new if/else/endif
Description:
------------
---
From manual page: http://www.php.net/migration.if-endif
---
Parser reports an error even the code is correct:
<?php
if ( 1 == 2 ):
echo 'one is the same as two';
if ( 3 == 3) echo 'liars may tell the truth sometimes';
else: //this is line 5
echo 'one is NOT the same as two';
endif;
echo '<br>';
?>
Parse error: syntax error, unexpected ':' in
/var/www/web4/html/Kunden/shared_tables/app/test.php on line 5
This can be easily hailed by adding a 2nd ';' after the statement in line
4:
... truth sometimes';;
It seems that the parser recognizes 'else:' as 2 syntacital tokens 'else'
and ':' instead of one.
Hint: the real php version is 5.2.6 - I'm an end-user, no idea about
packages.
Test script:
---------------
<?php
if ( 1 == 2 ):
echo 'one is the same as two';
if ( 3 == 3) echo 'liars may tell the truth sometimes';
else: //this is line 5
echo 'one is NOT the same as two';
endif;
echo '<br>';
?>
Expected result:
----------------
one is NOT the same as two
Actual result:
--------------
Parse error: syntax error, unexpected ':' in
/var/www/web4/html/Kunden/shared_tables/app/test.php on line 27
--
Edit bug report at http://bugs.php.net/bug.php?id=53730&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=53730&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=53730&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=53730&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=53730&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=53730&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=53730&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=53730&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=53730&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=53730&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=53730&r=support
Expected behavior: http://bugs.php.net/fix.php?id=53730&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=53730&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=53730&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=53730&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=53730&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=53730&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=53730&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=53730&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=53730&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=53730&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=53730&r=mysqlcfg