Bug #18151 Updated: php -w doesn't strip comments
| From: | sander@php.net | Date: | Thu, 04 Jul 2002 07:59:14 +0000 |
| Subject: | Bug #18151 Updated: php -w doesn't strip comments | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-13083@lists.php.net to get a copy of this message | ||
ID: 18151
Updated by: sander@php.net
-Summary: Strip comments (php -w) strips #!/usr/bin/php
directives!
Reported By: polone@townnews.com
Status: Open
-Bug Type: *General Issues
+Bug Type: Scripting Engine problem
Operating System: Linux
PHP Version: 4.2.1
New Comment:
No, the CLI (and possibly the CGI too) is programmed to ignore the
first line of a script if it starts with #.
Anyway, php -w (latest CVS) doesn't strip comments, although it's
supposed to. (ab)using this report for that issue.
Previous Comments:
------------------------------------------------------------------------
[2002-07-03 17:50:30] polone@townnews.com
The php -w option also strips comments outside of the PHP tags. Thus, a
program like:
#!/usr/bin/php -q
<?php
// Bye-Bye comment
print "hello world\n";
?>
Would end up like:
<?php
print "hello world\n"; ?>
But, this is incorrect. It should be:
#!/usr/bin/php -q
<?php
print "hello world\n"; ?>
It appears this only happens if the first line in the file is formatted
like a PHP comment. Thus,
# This is not a PHP comment!!!!
<?php
print "hello world\n";
?>
Also strips the "# This is not a PHP comment!!!!".
Regards,
Patrick O'Lone
INN/TownNews.com
polone@townnews.com
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18151&edit=1