php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64735 PHP alternative syntax is not parsed correctly
Submitted: 2013-04-29 17:31 UTC Modified: 2013-04-30 02:36 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: nick at savvior dot com Assigned:
Status: Not a bug Package: *Programming Data Structures
PHP Version: 5.4.14 OS: windows 7
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: nick at savvior dot com
New email:
PHP Version: OS:

 

 [2013-04-29 17:31 UTC] nick at savvior dot com
Description:
------------
5.4.3 using WAMP

To reproduce

The bug occurs only when you include the else: portion.

<?php

if (1):
if (1){}
else:
endif;

?>

result: 
syntax error: unexpected ':'






Test script:
---------------
<?php

//parse error
if (1):
if (1){}
else:
endif;


//works fine
if (1):
	if (1){}?><?
else:
endif;

?>




Expected result:
----------------
I expect to be able to use a traditional control structure syntax within the 
alternative syntax and have it parse correctly.

Actual result:
--------------
if else: is added after an if (): block that contains a traditional if statement 
w/o adding ?><? then it will be a parse error.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-30 02:36 UTC] laruence@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

"Mixing syntaxes in the same control block is not supported." 
http://www.php.net/manual/en/control-structures.alternative-syntax.php
 [2013-04-30 02:36 UTC] laruence@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 17:01:58 2024 UTC