php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7852 failure in 'alternate if'
Submitted: 2000-11-16 13:52 UTC Modified: 2000-11-17 04:54 UTC
From: kapn at kapn dot net Assigned:
Status: Closed Package: *General Issues
PHP Version: 4.0.3pl1 OS: FreeBSD
Private report: No CVE-ID: None
 [2000-11-16 13:52 UTC] kapn at kapn dot net
The following file will return a parse error at the 'endif;'

file1:
<!-- testif.html -->
<html>
    <head>
        <title>
                alternative if syntax test
	</title
    </head>
    <body>
    <?php
        include("testif.seg")
    ?>
		<H2>testing alternate if</H2>
    <?php
        endif;
    ?>
    </body>
</html>

file2:
<!-- testif.seg -->
    <?php
        if ($debug):
    ?>
         	<H2> Debug = <?php echo $debug ?></H2>
    <?php
        else:
    ?>


But if I cut and paste the inclusion into the file instead
it works fine.

<!-- testif2.html -->
<html>
    <head>
        <title>
                alternative if syntax test
	</title
    </head>
    <body>
    <!-- testif.seg -->
    <?php
        if ($debug):
    ?>
      		<H2> Debug = <?php echo $debug ?></H2>
    <?php
        else:
    ?>
      		<H2>testing alternate if</H2>
    <?php
        endif;
    ?>
    </body>
</html>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-17 04:54 UTC] hholzgra@php.net
see http://php.net/version4/incompatibilities.php, topic #2
about break and continue
the same is true for all the other control structures as
all their controling components have to be in the same
'parsing unit' aka file

 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sun Oct 11 21:00:02 2026 UTC