php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #26848 Make highlight functions XHTML 1.0 Strict compliant
Submitted: 2004-01-08 14:49 UTC Modified: 2004-01-10 14:35 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: phpman at fosketts dot co dot uk Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.3.4 OS: Win XP
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
38 - 28 = ?
Subscribe to this entry?

 
 [2004-01-08 14:49 UTC] phpman at fosketts dot co dot uk
Description:
------------
Will the highlight functions (highlight_string() and highlight_file()) be modified to produce valid XHTML 1.0 Strict output?  This has already been done in other functions, e.g. nl2br().  A simple solution would be to edit zend_highlight.c as follows:

1) Replace <font color=\"%s\"> with <span style=\"color: %s\"> on lines 106 and 155

2) Replace </font> with </span> on lines 151, 191 and 193

Thanks

Sean :)


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-01-10 10:21 UTC] moriyoshi@php.net
We'll do so when standard compliance really matters.

(IIRC, the current output is valid XHTML 1.0 
transitional.)

 [2004-01-10 11:57 UTC] phpman at fosketts dot co dot uk
Surely standards compliance matters now.  Any developer wishing to use these functions within a XHTML 1.0 Strict document will have to perform extra steps, even though a 'fix' could very easily be applied

I guess I'll have to keep doing this:

$str = preg_replace ( '#\<font color\=\"(.+?)\"\>#is', '<span style="color: $1">', $str );
$str = str_replace ( '</font>', '</span>', $str );

Sean :)
 [2004-01-10 14:35 UTC] moriyoshi@php.net
The core concept behind the XHTML strict standard 
appears to be extensive use of CSS as a separate set of 
information involved in visualisation. So however it 
complies with the standard, it shouldn't make sense 
unless we choose to go that way. Moreover, in respect to 
the compatibility with good-old non-CSS-capable browsers 
(including text browsers), we better leave it as is.

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon May 06 15:01:31 2024 UTC