#42346 [NEW]: highlight_string on string of PHP code with unterminated comment: wrong output
| From: | amazon_shipping_dept at yahoo dot com | Date: | Mon, 20 Aug 2007 09:29:29 +0000 |
| Subject: | #42346 [NEW]: highlight_string on string of PHP code with unterminated comment: wrong output | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-116344@lists.php.net to get a copy of this message | ||
From: amazon_shipping_dept at yahoo dot com
Operating system: Windows XP SP2
PHP version: 5.2.3
PHP Bug Type: Unknown/Other Function
Bug description: highlight_string on string of PHP code with unterminated comment: wrong output
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 bug report at http://bugs.php.net/?id=42346&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42346&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42346&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42346&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=42346&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=42346&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=42346&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=42346&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=42346&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=42346&r=support
Expected behavior: http://bugs.php.net/fix.php?id=42346&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=42346&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=42346&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=42346&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42346&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=42346&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=42346&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=42346&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=42346&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=42346&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=42346&r=mysqlcfg