php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #1373 mixed if: endif; /if{} blocks parse error when nested
Submitted: 1999-05-03 14:22 UTC Modified: 1999-06-20 20:33 UTC
From: markjr at easydns dot com Assigned:
Status: Closed Package: Parser error
PHP Version: 3.0 Latest CVS (03/05/1999) OS: Redhat 5.2
Private report: No CVE-ID: None
 [1999-05-03 14:22 UTC] markjr at easydns dot com
(I've commented out the rest of this class and look at
it with application/x-httpd-php3-source .phps)

This parses fine:

if($this->fp = fsockopen($this->SERVER, $this->PORT, &$this->ERRNO, &$this->ERRMSG)):
        fputs($fp, "GET $this->REQUEST $this->PROTO\n\n");
        while(!feof($this->fp)) {
                    $this->result.= fgets($this->fp,128);
            }
         # if($this->DEBUG) { echo $this->result; } 
    else:
        logit( "ERROR: submitting $field[domain] message was: $this->ERRMSG");
endif;

Now uncomment the line with if($this->DEBUG), I get
a parser error. I've noticed this happened to me on
occassion before, but I never got around to paring it
down to a few lines to reproduce it.

Move that exact uncommented line outside of the nesting
if:/endif; block and it also parses fine. In fact, moving
it into the else: block and it also parses fine. 

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1999-06-20 20:33 UTC] jim at cvs dot php dot net
The problem is that you can't do "if (cond) { stuff; } else: something_else();",
which is what you are trying to do. With your line commented
out, the "else:" gets associated with the initial "if():".

 [1999-06-20 20:33 UTC] jim at cvs dot php dot net
Whoops, forgot to close.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 18:01:28 2024 UTC