php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12323 // comment tag does not work
Submitted: 2001-07-23 17:19 UTC Modified: 2012-06-30 21:52 UTC
From: lael at evolutionmc dot com Assigned: felipe (profile)
Status: Closed Package: Output Control
PHP Version: 4.0.6 OS: Mac OS X
Private report: No CVE-ID: None
 [2001-07-23 17:19 UTC] lael at evolutionmc dot com
When I use the "//" as the comment, the text behind the tag 
is displayed out to the user.  I can replace it with a "/*" 
and put a "*/" at the end to make it work.  But I was 
hoping I had missed some compile option or something that 
is causing this to not work.





To make the installs on my G3 PowerMac Laptop, I have used 
the instructions found at: http://www.devshed.com/
Server_Side/Administration/BuildingOnOSX/

Any suggestions are welcome.

Thanks,
Lael

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-23 18:31 UTC] cnewbill@php.net
The only situation I can think of where this would happen is

<?php // print "stuff"; ?>

i.e. one liners

If this is your case this is expected behavior IIRC.  Otherwsie submit a small script that reproduces the problem.

-Chris
 [2001-07-23 18:35 UTC] cnewbill@php.net
Okay it would happen on more than one liners.

basically if you have a ?> on the same line as the // comment it will do this.

I know there is some other bugs on this same problem, but I don't have the numbers handy.

-Chris
 [2001-07-24 14:16 UTC] andy@php.net
unable to reproduce on RH Linux 7.

This sounds very bogus.
 [2001-07-24 14:27 UTC] lael at evolutionmc dot com
I received an email stating that it could not be reproduced 
on a  RH Linux 7 machine.  This problem is specific to Mac 
OS X client, so I'm sure that you were unable to reproduce 
it on your box.

Either way, this is definately happening and is not "bogus" 
as you said.
 [2001-07-24 14:28 UTC] lael at evolutionmc dot com
Also in reply to the other suggestions regarding one liners 
vs multiple line comments:

The lines I have commented are all on their own line and 
are one liners.  More or less, anywhere I use a "//" to 
comment, the entire line is displayed to the user.  The 
following two scripts will give me the same result.

<?php
    // This comment will show on the web page
?>

<?php
    print('// This comment will show on the web page');
?>

I noticed in the documentation that the "//" was considered 
a C++ style of commenting.  Do I possibly need a particular 
module or directive to say that "//" is a comment?

Thanks,
Lael
 [2001-07-24 15:40 UTC] lael at evolutionmc dot com
For those asking for an example of the script and the 
output.

Using the following:
<code>
<?php
    print("Working so far <BR>");
    print("Still working next line is going to be a 
comment<BR>");
    // This line should be a comment
    print("This is the next line past the comment<BR>");
?>
</code>

I get the following result:
<browser output>
// This line should be a comment print("This is the next 
line past the comment
"); Working so far 
Still working next line is going to be a comment
<end of browser output>

Thanking everyone for the help.  Greatly appreciate it.

Lael
 [2001-07-25 02:10 UTC] cynic@php.net
could you please check the source of the output (View -> Page Source in Netscape 4.x, and View -> Source in IE) to check that PHP scripts get actually executed?

(Sorry if this is dumb, but the example you provided really looks like this is the case.)
 [2001-07-25 11:40 UTC] lael at evolutionmc dot com
The ## works just the same as the //

Also, for those that asked I try it in Netscape.  Netscape 
does the same thing.  The php is being processed, it's just 
that any line with a "//" or a "##" will first be displayed 
up at the top of the page and then from the line after the 
comment the PHP will resume.


 [2001-07-27 13:01 UTC] sniper@php.net
status: open

 [2001-12-06 14:11 UTC] sander@php.net
As asked before by Cynic, can you view the source of the output of the PHP-file? It doesn't matter which browser you use. See the post of Cynic for instructions on doing this with IE or Netscape ;)
 [2001-12-06 14:11 UTC] sander@php.net
status->feedback
 [2001-12-27 05:53 UTC] lobbin@php.net
No feedback. Closing.
 [2012-06-30 21:52 UTC] felipe@php.net
-Assigned To: +Assigned To: felipe
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Sep 22 18:01:23 2020 UTC