php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27915 eval have problem with comments
Submitted: 2004-04-07 19:44 UTC Modified: 2004-05-09 03:25 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: albaity at hotmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.6 OS: WinXP pro IIS 6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: albaity at hotmail dot com
New email:
PHP Version: OS:

 

 [2004-04-07 19:44 UTC] albaity at hotmail dot com
Description:
------------
If you are trying to add a script such as hitbox, fastcounter or anything that has <!-- BEGIN WHATEVER CODE --> and <!-- END WHATEVER CODE --> statements in it to .tpl file, you may be recieving such errors as 

Quote: 
Parse error: parse error, unexpected T_STRING in /root/phpBB/includes/template.php(127) : eval()'d code on line 50  


This is due to how phpBB handles <!-- BEGIN --> and <!-- END -->'s. The template system is setup to interpret these in special ways, such as loops and switches, and not having such an object between them results in parse errors. 

So, to fix it delete the 'BEGIN' and 'END' in your HTML comments. You should also write all of your comments in lower case. ex: 

Code that gives you errors: 

Code: 
<!-- BEGIN FASTCOUNTER CODE --> 
<a href="http://member.bcentral.com/cgi-bin/fc/fastcounter-login?2440090" target="_top"> 
<img border="0" src="http://fastcounter.bcentral.com/fastcounter?2440090+4880187"></a> 
<!-- END FASTCOUNTER CODE --> 
<br> 
<!-- BEGIN FASTCOUNTER LINK --> 
<font face="arial" size="1"> 
<a href="http://fastcounter.bcentral.com/fc-join" target="_top">FastCounter by bCentral</a></font><br> 
<!-- END FASTCOUNTER LINK --> 
 


Will be changed to this: 

Code: 
<!-- fastcounter code --> 
<a href="http://member.bcentral.com/cgi-bin/fc/fastcounter-login?2440090" target="_top"> 
<img border="0" src="http://fastcounter.bcentral.com/fastcounter?2440090+4880187"></a> 
<!-- fastcounter code --> 
<br> 
<!-- fastcounter code --> 
<font face="arial" size="1"> 
<a href="http://fastcounter.bcentral.com/fc-join" target="_top">FastCounter by bCentral</a></font><br> 
<!-- fastcounter code -->  


That will solve the parsing errors.

Reproduce code:
---------------
If you are trying to add a script such as hitbox, fastcounter or anything that has <!-- BEGIN WHATEVER CODE --> and <!-- END WHATEVER CODE --> statements in it to .tpl file, you may be recieving such errors as 

Quote: 
Parse error: parse error, unexpected T_STRING in /root/phpBB/includes/template.php(127) : eval()'d code on line 50  


This is due to how phpBB handles <!-- BEGIN --> and <!-- END -->'s. The template system is setup to interpret these in special ways, such as loops and switches, and not having such an object between them results in parse errors. 

So, to fix it delete the 'BEGIN' and 'END' in your HTML comments. You should also write all of your comments in lower case. ex: 

Code that gives you errors: 

Code: 
<!-- BEGIN FASTCOUNTER CODE --> 
<a href="http://member.bcentral.com/cgi-bin/fc/fastcounter-login?2440090" target="_top"> 
<img border="0" src="http://fastcounter.bcentral.com/fastcounter?2440090+4880187"></a> 
<!-- END FASTCOUNTER CODE --> 
<br> 
<!-- BEGIN FASTCOUNTER LINK --> 
<font face="arial" size="1"> 
<a href="http://fastcounter.bcentral.com/fc-join" target="_top">FastCounter by bCentral</a></font><br> 
<!-- END FASTCOUNTER LINK --> 
 


Will be changed to this: 

Code: 
<!-- fastcounter code --> 
<a href="http://member.bcentral.com/cgi-bin/fc/fastcounter-login?2440090" target="_top"> 
<img border="0" src="http://fastcounter.bcentral.com/fastcounter?2440090+4880187"></a> 
<!-- fastcounter code --> 
<br> 
<!-- fastcounter code --> 
<font face="arial" size="1"> 
<a href="http://fastcounter.bcentral.com/fc-join" target="_top">FastCounter by bCentral</a></font><br> 
<!-- fastcounter code -->  


That will solve the parsing errors.

Expected result:
----------------
If you are trying to add a script such as hitbox, fastcounter or anything that has <!-- BEGIN WHATEVER CODE --> and <!-- END WHATEVER CODE --> statements in it to .tpl file, you may be recieving such errors as 

Quote: 
Parse error: parse error, unexpected T_STRING in /root/phpBB/includes/template.php(127) : eval()'d code on line 50  


This is due to how phpBB handles <!-- BEGIN --> and <!-- END -->'s. The template system is setup to interpret these in special ways, such as loops and switches, and not having such an object between them results in parse errors. 

So, to fix it delete the 'BEGIN' and 'END' in your HTML comments. You should also write all of your comments in lower case. ex: 

Code that gives you errors: 

Code: 
<!-- BEGIN FASTCOUNTER CODE --> 
<a href="http://member.bcentral.com/cgi-bin/fc/fastcounter-login?2440090" target="_top"> 
<img border="0" src="http://fastcounter.bcentral.com/fastcounter?2440090+4880187"></a> 
<!-- END FASTCOUNTER CODE --> 
<br> 
<!-- BEGIN FASTCOUNTER LINK --> 
<font face="arial" size="1"> 
<a href="http://fastcounter.bcentral.com/fc-join" target="_top">FastCounter by bCentral</a></font><br> 
<!-- END FASTCOUNTER LINK --> 
 


Will be changed to this: 

Code: 
<!-- fastcounter code --> 
<a href="http://member.bcentral.com/cgi-bin/fc/fastcounter-login?2440090" target="_top"> 
<img border="0" src="http://fastcounter.bcentral.com/fastcounter?2440090+4880187"></a> 
<!-- fastcounter code --> 
<br> 
<!-- fastcounter code --> 
<font face="arial" size="1"> 
<a href="http://fastcounter.bcentral.com/fc-join" target="_top">FastCounter by bCentral</a></font><br> 
<!-- fastcounter code -->  


That will solve the parsing errors.

Actual result:
--------------
If you are trying to add a script such as hitbox, fastcounter or anything that has <!-- BEGIN WHATEVER CODE --> and <!-- END WHATEVER CODE --> statements in it to .tpl file, you may be recieving such errors as 

Quote: 
Parse error: parse error, unexpected T_STRING in /root/phpBB/includes/template.php(127) : eval()'d code on line 50  


This is due to how phpBB handles <!-- BEGIN --> and <!-- END -->'s. The template system is setup to interpret these in special ways, such as loops and switches, and not having such an object between them results in parse errors. 

So, to fix it delete the 'BEGIN' and 'END' in your HTML comments. You should also write all of your comments in lower case. ex: 

Code that gives you errors: 

Code: 
<!-- BEGIN FASTCOUNTER CODE --> 
<a href="http://member.bcentral.com/cgi-bin/fc/fastcounter-login?2440090" target="_top"> 
<img border="0" src="http://fastcounter.bcentral.com/fastcounter?2440090+4880187"></a> 
<!-- END FASTCOUNTER CODE --> 
<br> 
<!-- BEGIN FASTCOUNTER LINK --> 
<font face="arial" size="1"> 
<a href="http://fastcounter.bcentral.com/fc-join" target="_top">FastCounter by bCentral</a></font><br> 
<!-- END FASTCOUNTER LINK --> 
 


Will be changed to this: 

Code: 
<!-- fastcounter code --> 
<a href="http://member.bcentral.com/cgi-bin/fc/fastcounter-login?2440090" target="_top"> 
<img border="0" src="http://fastcounter.bcentral.com/fastcounter?2440090+4880187"></a> 
<!-- fastcounter code --> 
<br> 
<!-- fastcounter code --> 
<font face="arial" size="1"> 
<a href="http://fastcounter.bcentral.com/fc-join" target="_top">FastCounter by bCentral</a></font><br> 
<!-- fastcounter code -->  


That will solve the parsing errors.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-07 19:47 UTC] albaity at hotmail dot com
the problem is with eval function
and sorry for spam or flood details :(
 [2004-04-07 22:31 UTC] pollita@php.net
And what problem is that?

The only thing described in the bug report is scripting problems which don't belong in this bug system.
 [2004-04-08 13:04 UTC] albaity at hotmail dot com
THE PROBLEM THAT THE EVAL WILL NOT WORK GOOD IF I HAVE 
COMMENTS (IN UPPER CASE OR HAVE BEG OR END) IN MY STRING AND THAT IS VERY BAD BECAUSE THAT IS A BAD ISSUE IF I WANT TO CREATE A (TEMPLATE SYSTEM) AND ITS VERY BAD BECAUSE WE DO NOT HAVE A NOTE ABOUT (THAT EVAL HAVE RESTRICTION IN STRINGS AND NOT ACCEPT COMMENTS WITH BEG OR END)
 [2004-04-08 13:46 UTC] derick@php.net
Bugger off.
 [2004-04-08 14:05 UTC] amt@php.net
What are you talking about? This works perfectly fine.

$ php -r '$foo = "<!-- FOO --><?php print 1;"; eval("?
>$foo");'

<!-- FOO -->1



 [2004-05-09 03:25 UTC] albaity at hotmail dot com
try :
$ php -r '$foo = "<!--BEG FOO--><?php print 1;"; eval("?
>$foo");'

<!--END FOO-->
its a logical bug
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 20 16:01:35 2024 UTC