php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40776 highlight.bg setting ignored/unused
Submitted: 2007-03-11 13:45 UTC Modified: 2007-04-26 09:46 UTC
Votes:2
Avg. Score:3.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: seanius at debian dot org Assigned: tony2001 (profile)
Status: Closed Package: PHP options/info functions
PHP Version: 5.2.1 OS: Debian GNU/Linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: seanius at debian dot org
New email:
PHP Version: OS:

 

 [2007-03-11 13:45 UTC] seanius at debian dot org
Description:
------------
originally reported at http://bugs.debian.org/405338

it seems that the highlight.bg setting is being ignored for highlight_string/highlight_file().  or perhaps this setting is obsoleted/removed intentionally?  the online docs and php-provided ini files still reference this setting though, and it shows up correctly in phpinfo().

grepping through the source for php5 however, i don't find much referencing the setting apart from the ini file and some test cases.  the highlight_file function in ext/standard/base_functions.c sets the other settings from the "higlight struct", but not the .bg setting.

Reproduce code:
---------------
<?php
 
 # set highlight.bg to something obvious like #ff0000
 # and you'll see that the background stays default.
 # Comment
 highlight_file($_SERVER['SCRIPT_FILENAME']);
 
?>

Expected result:
----------------
a red background

Actual result:
--------------
a white default background

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-06 23:15 UTC] seanius at debian dot org
hi, just fyi:

a patch has been supplied by the reporter in the debian bts:

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=405338;msg=34;filename=118-highlight_bg.patch;att=1

sorry the urls for attachments suck, you can also browse to it at the address originally provided :)
 [2007-04-07 11:49 UTC] johannes@php.net
The patch should be changed to not using the HTML body tag for the background color since highlight_file() might be used to embed highlighted code into another file. I also see no need to use highlight_bg as last_color.
 [2007-04-07 18:45 UTC] seanius at debian dot org
okay, since i'm just kind of acting as an inefficient middle-man here i'll ask the reporter to comment directly to the bug here :)
 [2007-04-07 20:43 UTC] info at noctus dot net
> The patch should be changed to not using the HTML body tag for the
background color since highlight_file() might be used to embed
highlighted code into another file.

Then the alternative could be to drop the body element again and put the background color for the code element with an additional display:block; But this way a white margin will remain around the displayed source code.

> I also see no need to use highlight_bg as last_color.

Ah yes, you&#8217;re right; I could have used syntax_highlighter_ini->highlight_bg directly.
 [2007-04-26 09:46 UTC] tony2001@php.net
Removed highlight.bg in HEAD, but I can't touch it in PHP5 as it would break binary compat.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC