Req #42346 [Opn->Csd]: highlight_string on string of PHP code with unterminated comment: wrong output
| From: | nikic@php.net | Date: | Tue, 05 Jun 2012 23:09:46 +0000 |
| Subject: | Req #42346 [Opn->Csd]: highlight_string on string of PHP code with unterminated comment: wrong output | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-171057@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=42346&edit=1
ID: 42346
Updated by: nikic@php.net
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"><?php </span><span
style="color: #007700">echo </span><span style="color:
#DD0000">"hello"</span><span style="color:
#007700">; </span><span style="color:
#FF8000">/*comment*/ </span><span style="color:
#FF8000">/*unterminated comment;</span>
</span>
</code>
Actual result:
--------------
<code><span style="color: #000000">
<span style="color: #0000BB"><?php </span><span
style="color: #007700">echo </span><span style="color:
#DD0000">"hello"</span><span style="color:
#007700">; </span><span style="color:
#FF8000">/*comment*/ </span>
</span>
</code>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=42346&edit=1