php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26703 highlight_string and similar highlights improper characters as a keyword
Submitted: 2003-12-23 03:36 UTC Modified: 2003-12-26 05:04 UTC
From: vrana@php.net Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.3.4 OS: Any
Private report: No CVE-ID: None
 [2003-12-23 03:36 UTC] vrana@php.net
Description:
------------
There are two issues with highlight_string, highlight_file and `php -s`:

1. Some characters (like []{}) are highlighted in non-constant strings (i.e. double quote strings with variables) as a keyword even on places where they don't have any special purpose.

2. Some characters ([]{} and backslash sequences) are highlighted in non-constant strings and aren't highlighted in constant strings. It should be consistent.

Suggested solution: Don't highlight anything as a keyword both in constant and non-constant strings.

I've already sent a patch for this to internals@lists.php.net.

Reproduce code:
---------------
<?php
highlight_string('<?php "foo[] $a \n"; ?>');
?>


Expected result:
----------------
<code><font color="#000000">
<font color="#0000BB">&lt;?php </font><font color="#DD0000">"foo[] $a \n"</font><font color="#007700">; </font><font color="#0000BB">?&gt;</font>
</font>
</code>

Actual result:
--------------
<code><font color="#000000">
<font color="#0000BB">&lt;?php </font><font color="#DD0000">"foo</font><font color="#007700">[]</font><font color="#DD0000"> $a </font><font color="#007700">\n</font><font color="#DD0000">"</font><font color="#007700">; </font><font color="#0000BB">?&gt;</font>
</font>
</code>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-23 04:12 UTC] derick@php.net
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

You already reported a bug about this before.
 [2003-12-25 04:39 UTC] vrana@php.net
This is different. In #26629, I complain about not highlighting some characters in constant strings. As you told me that it will be hard to implement, I sent this bug report complaining about highlighting those characters in non-constant strings (so it is opposite). Besides there's another issue with this (marked as 1.).

Can you please read whole bug report and take a look on sent patch? There are two reasons to accept it and no reason to reject it.
 [2003-12-25 04:47 UTC] derick@php.net
It's all the same issue, get over it.
 [2003-12-25 04:55 UTC] vrana@php.net
There are two issues with the highlighting. I described them quite precisely. It can not be expected behavior as it behave strange (1) and inconsistent (2). The fix is easy and I already sent a patch for it. Why don't you accept the patch and marking this bug bogus again and again?
 [2003-12-25 13:54 UTC] iliaa@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2003-12-26 05:04 UTC] vrana@php.net
Happy end :-). Thanks a lot, Ilia.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 02 21:01:28 2024 UTC