From:             
Operating system: Linux Debian 5 'Lenny'
PHP version:      5.2.17
Package:          Scripting Engine problem
Bug Type:         Bug
Bug description:Parsing bug if a pattern looking like closing ASP tag appears 
in comment

Description:
------------
A parsing error occurs if a pattern looking like a closing ASP tag appears
inside a line comment (beginning by '//'), in a PHP engine having 'asp_tags
= On' in the 'php.ini' file.



If I remove the "//" comment, I have a big "Line 2" visible, and there is
no bug.

If I use a "/* */" style comment instead, there is no bug.

If I put quotes around "140%" in the "size" attribute, there is no bug.

If I set the "asp_tags" options to "Off", or if I remove it, there is no
bug.

Removing the 'if' condition around the comment results in another kind of
problem (no error, but part of HTML code visible).



I found this because I was trying to install the latest version of OCS
Inventory (http://www.ocsinventory-ng.org/), and I didn't understand why I
got a white page and a PHP parse error after the first step of
installation: I have 'asp_tags = On' in 'php.ini', and there is effectively
a commented out '%>' pattern in their code.



Looks like a little to Bug #4879 (more than 10 years old).

Test script:
---------------
<html>

 <head><title>Asp tag bug</title></head>

 <body>

  Line 1<br>

<?php

  if (true) {

  //echo "<font size=140%>Line 2</font><br>";

  }

?>

  Line 3<br>

 </body>

</html>



Expected result:
----------------
Two text lines in browsers's Window :



"Line 1"

"Line 3"

Actual result:
--------------
A white page, and the following error in Apache log :

PHP Parse error:  syntax error, unexpected $end in
/var/www/[...]/asp_tag_bug.php on line 13

-- 
Edit bug report at http://bugs.php.net/bug.php?id=54306&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=54306&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=54306&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=54306&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=54306&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=54306&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=54306&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=54306&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=54306&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=54306&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=54306&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=54306&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=54306&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=54306&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=54306&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=54306&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=54306&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=54306&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=54306&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=54306&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=54306&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=54306&r=mysqlcfg

Reply via email to