Edit report at https://bugs.php.net/bug.php?id=42346&edit=1

 ID:                 42346
 Updated by:         [email protected]
 Reported by:        amazon_shipping_dept at yahoo dot com
 Summary:            highlight_string on string of PHP code with
                     unterminated comment: wrong output
-Status:             Open
+Status:             Closed
 Type:               Feature/Change Request
 Package:            Scripting Engine problem
 Operating System:   Windows XP SP2
 PHP Version:        5.2.3
-Assigned To:        
+Assigned To:        nikic
 Block user comment: N
 Private report:     N

 New Comment:

Closing as this was already fixed in the meantime. See demo at 
http://codepad.viper-7.com/1TO1RC.


Previous Comments:
------------------------------------------------------------------------
[2007-08-20 09:29:28] amazon_shipping_dept at yahoo dot com

Description:
------------
Running highlight_string() on a string with PHP code and an unterminated 
comment, produces output that doesn't have the comment. Additionally, when the 
string is dynamically generated from the file-content of a PHP file using 
file_get_contents(), a PHP warning about unterminated comments is present in 
the output.

Reproduce code:
---------------
echo highlight_string('<?php echo "hello"; /*comment*/ /*unterminated comment', 
true);

Expected result:
----------------
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: 
#007700">echo&nbsp;</span><span style="color: #DD0000">"hello"</span><span 
style="color: #007700">;&nbsp;</span><span style="color: 
#FF8000">/*comment*/&nbsp;</span><span style="color: #FF8000">/*unterminated 
comment;</span>
</span>
</code>

Actual result:
--------------
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php&nbsp;</span><span style="color: 
#007700">echo&nbsp;</span><span style="color: #DD0000">"hello"</span><span 
style="color: #007700">;&nbsp;</span><span style="color: 
#FF8000">/*comment*/&nbsp;</span>
</span>
</code>


------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=42346&edit=1

Reply via email to