Re: PHP 4.0 Bug #8180: Multiple "else" clauses in an "if" statement do not generate an error
| From: | Adam Trachtenberg | Date: | Sat, 09 Dec 2000 00:52:46 +0000 |
| Subject: | Re: PHP 4.0 Bug #8180: Multiple "else" clauses in an "if" statement do not generate an error | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-40622@lists.php.net to get a copy of this message | ||
Are you sure you're not logging errors instead? Also, I think your
user-agent may be supplying this page because the document contains no
data.
-adam
On 9 Dec 2000 greg@adhesivemedia.com wrote:
> From: greg@adhesivemedia.com
> Operating system: Winnt 4.0 sp6
> PHP version: 4.0.3pl1
> PHP Bug Type: Scripting Engine problem
> Bug description: Multiple "else" clauses in an "if" statement do not
> generate an error
>
> The following script does not generate a parse error, and results in either zero output (an
> empty document), or a skeletal HTML document unrelated to the desired output (see below).
>
> Sample script
> ----------------------------------------------
> <?php
>
> if ( 1 ) {
> print("1");
> } else {
> print("2");
> } else {
> print("3");
> }
>
> ?>
> ----------------------------------------------
>
>
> Weird HTML output
> ----------------------------------------------
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>
> <META http-equiv=Content-Type content="text/html;
> charset=windows-1252"></HEAD>
> <BODY></BODY></HTML>
> ----------------------------------------------
> (note: this HTML output is unrelated to any code in the php file. It appears to be coming from
> the script engine itself?)
>
> The expecetd behavior would be that an error is generated by the script engine. This proved to
> be an irritating bug to track down on a fairly complex page with multiple nested "if"
> statements, since no error was reported and no content was generated.
>
> One other note, this same sample file generates a parse error on our FreeBSD box running PHP
> 4.0.2.
>
>
>
--
/ adam maccabee trachtenberg | visit college life online \
\ adam@student.net | http://www.student.com /