php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27901 highlight_* produces random results
Submitted: 2004-04-07 06:05 UTC Modified: 2004-05-05 22:29 UTC
Votes:9
Avg. Score:3.6 ± 0.5
Reproduced:8 of 8 (100.0%)
Same Version:3 (37.5%)
Same OS:3 (37.5%)
From: mr dot heat at gmx dot de Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 4.3.5 OS: i686-suse-linux
Private report: No CVE-ID: None
 [2004-04-07 06:05 UTC] mr dot heat at gmx dot de
Description:
------------
highlight_string() produces strange random results (random means, I reload the page and get one of two different results). Sometimes the highlighted string starts in HTML mode (as expected), sometimes it starts in PHP mode (similar to eval()). The effect is, the whole highlighted string becomes blue.

In "foo <?php bar(); ?>" for example "foo" becomes blue instead of black.

Reproduce code:
---------------
<?highlight_string("Text")?>

Or check http://phpcenter.de/~thiemo/bug.php and reload the page sometimes. The script running there is: <?=htmlspecialchars(highlight_string("Text", true))?>

Expected result:
----------------
<code><font color="#000000"> Text</font> </code>

Actual result:
--------------
Sometimes:

<code><font color="#000000"> Text</font> </code>

and sometimes (just reload the page sometimes without any change):

<code><font color="#000000"> <font color="#0000BB">Text</font> </font> </code>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-04-07 08:22 UTC] derick@php.net
I reloaded that site a couple of hundred times, but it always showed the correct result...
 [2004-04-07 11:11 UTC] mr dot heat at gmx dot de
I tried again several minutes ago. First it displayed the wrong result. Then it displayed the right result and I was unable to get the wrong result again. It seems dependent from the time (?).
 [2004-04-07 11:21 UTC] fb at fbeyer dot com
I have seen this bug in action in the forum script at www.php-center.de and could also reproduce it using Thiemo's sample URL.

You have to refresh the page periodically. I did not see any regularity, there are alternating iterations of correct and false behavior.
 [2004-04-14 09:13 UTC] fb at fbeyer dot com
You can even experience this bug within the user notes at the PHP home page. Sometimes the notes are highlighted even without beeing surrounded by PHP tags.

Again, I can't see a rule when it works wrong and when it doesn't. Very weird!
 [2004-04-26 00:25 UTC] sniper@php.net
There is no ZE2 in PHP 4..so either fix the version to the correct one (after testing with the latest snapshot) or leave this bogus. (btw. I can't reproduce after couple of hundred thousand runs..)


 [2004-04-26 00:43 UTC] tomsommer@php.net
I just reproduced it on the link and have also seen this in the usernotes.

Could you perhaps provide a phpinfo() and the browser you are using (user-agent string)?
 [2004-04-26 09:57 UTC] mr dot heat at gmx dot de
Change the category if it is wrong, please.

A phpinfo() is here: http://phpcenter.de/~thiemo/phpinfo.php This is independend from the user agent.
 [2004-04-27 06:21 UTC] helgi at trance dot is
Reloaded the site couple of times, got the wrong result in half of the times
 [2004-05-05 22:29 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2004-07-11 06:56 UTC] email at dalegroup dot net
I am seeing this problem with my code.
Sometimes highlight_string outputs correctly and other times it doesn't add the colour.

An example can be seen here:
http://www.dalegroup.net/index.php?newsid=37#comments
You may need to reload the page a few times.

The server is running Windows2003, php 4.3.7 and apache 2.0.50.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 11 13:01:29 2024 UTC