php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5828 PHP crashes with bad syntax in nested switch statements
Submitted: 2000-07-28 05:32 UTC Modified: 2000-08-20 02:15 UTC
From: ccurtis at aet-usa dot com Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0.1pl2 OS: Linux (Debian/Unstable)
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: ccurtis at aet-usa dot com
New email:
PHP Version: OS:

 

 [2000-07-28 05:32 UTC] ccurtis at aet-usa dot com
This is just pseudo-code, but it (roughly) crashes PHP:

Function foo()
{	while( 1 )
	{	switch( "b" )
		{	case "a":
				break;
			case "b":
				if( 1 )
				{	switch( "foo" )
					{	case "A":
						case "B"
						break;
						default:
						return 0;
					}
				}
		}
	}
}

The key here is the code:

``
case "A":
case "B"
	break;
''

Placing the ``:'' after the B case works normally, but without it PHP crashes (Document contains no data).

As an aside, statements like this:
if( something )
}

*really* confuse the parser.  Instead of getting an error here, I get undefined function errors, which is really misleading.

regards,
Christopher

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-28 10:45 UTC] waldschrott@php.net
yields in a parse error on win2k, seems to be OS specific, I`ve noticed that Win2k crashes too on code that produces parse errors on other OSs
 [2000-07-29 12:45 UTC] stas@php.net
Could you please provide crash batcktrace (see http://bugs.php.net/bugs-generating-backtrace.php)?
 [2000-08-20 02:15 UTC] sniper@php.net
No feedback from user.

--Jani
 
PHP Copyright © 2001-2026 The PHP Group
All rights reserved.
Last updated: Sat Oct 10 22:00:02 2026 UTC