#24226 [Opn->Bgs]: Can't close then reopen a PHP script within class definition

From: Date: Tue, 17 Jun 2003 16:04:02 +0000
Subject: #24226 [Opn->Bgs]: Can't close then reopen a PHP script within class definition
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-42139@lists.php.net to get a copy of this message
ID: 24226 Updated by: sniper@php.net Reported By: stephane dot drouard at st dot com -Status: Open +Status: Bogus -Bug Type: *Compile Issues +Bug Type: *General Issues Operating System: Lunix PHP Version: 4.3.2 New Comment: It might not be clear right away but this is how it's seen by PHP: <? class test { ; function test() { print 'OK'; } } From the manual, http://www.php.net/manual/en/language.basic-syntax.php "The closing tag for the block will include the immediately trailing newline if one is present. Also, the closing tag automatically implies a semicolon; you do not need to have a semicolon terminating the last line of a PHP block." Previous Comments: ------------------------------------------------------------------------ [2003-06-17 10:17:06] stephane dot drouard at st dot com Description: ------------ I'm using Dreamweaver and it handles editable regions by inserting HTML comments. To do so within PHP code, we need to close the script and to reopen it after. It works fine within functions (including class functions), loops, if, ... The only case (I identified) that does not work is within class definitions. Reproduce code: --------------- <? class test { ?> <!-- comment --> <? function test() { print 'OK'; } } ?> Expected result: ---------------- It should compile Actual result: -------------- Parse error: parse error, expecting T_OLD_FUNCTION' or T_FUNCTION' or T_VAR' or '}'' in <file> on line 3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24226&edit=1

« previous php.bugs (#42139) next »