php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43931 "if: if(){} else:" causes problem
Submitted: 2008-01-25 00:44 UTC Modified: 2008-01-28 23:09 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: konstantin at schukraft dot org Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.4.8 OS: Debian Linux 2.6.20
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: konstantin at schukraft dot org
New email:
PHP Version: OS:

 

 [2008-01-25 00:44 UTC] konstantin at schukraft dot org
Description:
------------
This could be related to bug #18413, but here, I don't mix styles within the same layer like it was done in 18413, therefor this code should definitly work. PHP should be able to find associate the else with the first if, not the second.

Reproduce code:
---------------
if(true):
 if(true)
 {
 }
else:
endif;

Expected result:
----------------
Parsing without problems.

Actual result:
--------------
Parse error: syntax error, unexpected ':' in whatever.php on line X
where X is the line with the "else:"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-01-25 00:48 UTC] felipe@php.net
In this case, use ';' after bracket.

e.g.

if (true):
    if (true)
    {
        // do something
    };
else:
    // ...
endif;
 [2008-01-28 23:09 UTC] tony2001@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


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 21:01:29 2024 UTC