php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27393 syntax highlighter uses obsolete <font>
Submitted: 2004-02-25 08:21 UTC Modified: 2004-02-25 09:07 UTC
From: mg at iceni dot pl Assigned:
Status: Closed Package: Unknown/Other Function
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
 [2004-02-25 08:21 UTC] mg at iceni dot pl
Description:
------------
syntax highlighter uses <font> which is removed in xhtml. 
nl2br is already xhtml compilant so highlight_[string|
file] should be too. 
 
Here is simple patch (for php4 and php5) which replaces 
<font> with <span> 
 
diff -u2 Zend/zend_highlight.c 
Zend-patched/zend_highlight.c 
--- Zend/zend_highlight.c       2004-01-08 
18:31:47.000000000 +0100 
+++ Zend-patched/zend_highlight.c       2004-02-25 
14:17:41.154198944 +0100 
@@ -106,5 +106,5 @@ 
 
        zend_printf("<code>"); 
-       zend_printf("<font color=\"%s\">\n", last_color); 
+       zend_printf("<span style=\"color: %s\">\n", 
last_color); 
        /* highlight stuff coming back from zendlex() */ 
        token.type = 0; 
@@ -150,9 +150,9 @@ 
                if (last_color != next_color) { 
                        if (last_color != 
syntax_highlighter_ini->highlight_html) { 
-                               zend_printf("</font>"); 
+                               zend_printf("</span>"); 
                        } 
                        last_color = next_color; 
                        if (last_color != 
syntax_highlighter_ini->highlight_html) { 
-                               zend_printf("<font 
color=\"%s\">", last_color); 
+                               zend_printf("<span 
style=\"color: %s\">", last_color); 
                        } 
                } 
@@ -185,7 +185,7 @@ 
        } 
        if (last_color != 
syntax_highlighter_ini->highlight_html) { 
-               zend_printf("</font>\n"); 
+               zend_printf("</span>\n"); 
        } 
-       zend_printf("</font>\n"); 
+       zend_printf("</span>\n"); 
        zend_printf("</code>"); 
 } 
 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-02-25 08:32 UTC] derick@php.net
Please provide a link to the patch as it got garbled here.
 [2004-02-25 08:47 UTC] mg at iceni dot pl
http://iceni.pl/highlight.patch
 [2004-02-25 09:07 UTC] derick@php.net
Thanks, I committed this for PHP 5. (But not for PHP 4 as that one is in a bugfix only cycle).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 05:01:30 2024 UTC