|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #8180 Multiple "else" clauses in an "if" statement do not generate an error
Submitted: 2000-12-08 19:23 UTC Modified: 2000-12-08 20:47 UTC
From: greg at adhesivemedia dot com Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.3pl1 OS: Winnt 4.0 sp6
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: greg at adhesivemedia dot com
New email:
PHP Version: OS:


 [2000-12-08 19:23 UTC] greg at adhesivemedia dot com
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

 if ( 1 ) {
 } else {
 } else {


Weird HTML output
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
(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.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-12-08 19:50 UTC]
This works just like it should, generates a parse error for me.
(I'm using the latest CVS)

Check your php.ini:

error_reporting = E_ALL

if it is something else, try changing to E_ALL.
And if it still doesn't generate an error, try PHP4.0.4RC4:

 [2000-12-08 20:47 UTC]
User feedback:
My mistake. Our NT server had:
but our FreeBSD server had:
error_reporting = E_ALL & ~E_NOTICE

Now that I've re-configured the NT box, it's reporting the error just

PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat Apr 17 21:01:27 2021 UTC