Bug #17895 Updated: Strange bug about comments

From: Date: Fri, 21 Jun 2002 12:41:25 +0000
Subject: Bug #17895 Updated: Strange bug about comments
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-11667@lists.php.net to get a copy of this message
ID: 17895 Updated by: php@ak-dev.com Reported By: php@ak-dev.com Status: Bogus Bug Type: Scripting Engine problem Operating System: Windows 2000 PHP Version: 4.1.2 New Comment: It means that you cannot write this type of code: !? <? // previous code // mysql_connect('otherhost', 'toto', 'titi'); // //?> // mysql_connect('localhost', 'riri', 'fifi'); ?> This code has no real way, but it represents a problem, real code could be similary for other problems! but you can write this: <? /* previous code mysql_connect('otherhost', 'toto', 'titi'); ?> */ mysql_connect('localhost', 'riri', 'fifi'); ?> In my mind, even if it is a bug, it is the right way to do! a one-line comment has to comment to the end of the line in EVERY CASE!!!! Previous Comments: ------------------------------------------------------------------------ [2002-06-21 08:27:50] hholzgra@php.net http://www.php.net/manual/en/language.basic-syntax.comments.php "The one-line comment styles actually only comment to the end of the line or the current block of PHP code, whichever comes first. This means that HTML code after // ?> WILL be printed: ?> skips out of the PHP mode and returns to HTML mode, and // cannot influence that." ------------------------------------------------------------------------ [2002-06-21 07:35:57] derick@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 ------------------------------------------------------------------------ [2002-06-21 07:26:53] php@ak-dev.com I think I have found a strange bug, but I am not sure it is one! I explain my problem: //?> #?> If you insert one of those two previous lines, the parse will crash! In my mind, # or // are 'one line comments' and in this way, it has to be impossible to execute code on the same line after those comment tags, but here it is possible! So it is very dangerous to put //?> or #? in your source code! In some cases, it does a crash and it results a parse error, and in others cases it displays source code of the file!! In my mind, it is not normal... ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=17895&edit=1

« previous php.bugs (#11667) next »