#29304 [Bgs]: Parse error with "switch" and html code

From: Date: Wed, 21 Jul 2004 15:38:12 +0000
Subject: #29304 [Bgs]: Parse error with "switch" and html code
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-63268@lists.php.net to get a copy of this message
ID: 29304 User updated by: devis at witcom dot com Reported By: devis at witcom dot com Status: Bogus Bug Type: Compile Failure Operating System: Linux Debian PHP Version: 4.3.7 New Comment: <? switch($var){ ?> <? case "alpha": break; }?> should be equivalent to <? switch($var){ print "\n" case "alpha": break; }?> so why does it work if this <? switch($var){ print " " case "alpha": break; }?> does not work ? Previous Comments: ------------------------------------------------------------------------ [2004-07-21 16:37:13] iliaa@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Read Zeev's response to the original bug report. ------------------------------------------------------------------------ [2004-07-21 16:17:38] devis at witcom dot com Description: ------------ Bug #11447 REOPENED when ther is html code between "switch" and the first "case" php reports this error: "Parse error: parse error, expecting `T_ENDSWITCH' or T_CASE' or T_DEFAULT'" the problem occurs while indenting html+php code: <html> <body> <?switch ($a):?> <?case 0: echo "zero"; break;?> <?default: echo "one"; break;?> <?endswitch;?> </body> </html> Reproduce code: --------------- THIS WORKS: <html> <?switch ($a):?> <?case 0: echo "zero"; break;?> <?default: echo "one"; break;?> <?endswitch;?> </html> THIS DOESN'T WORK: <html> <?switch ($a):?> [space]<?case 0: echo "zero"; break;?> <?default: echo "one"; break;?> <?endswitch;?> </html> Expected result: ---------------- "zero" ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=29304&edit=1

« previous php.bugs (#63268) next »