php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #46100 tidy does not replace fonts with styles
Submitted: 2008-09-16 22:14 UTC Modified: 2008-10-25 22:58 UTC
From: lukemoynihan at gmail dot com Assigned:
Status: Not a bug Package: Tidy (PECL)
PHP Version: 5.2.6 OS: windows xp
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 you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: lukemoynihan at gmail dot com
New email:
PHP Version: OS:

 

 [2008-09-16 22:14 UTC] lukemoynihan at gmail dot com
Description:
------------
when tidy has the 'clean' option set it should convert font tags into css styles, php's tidy extension does not seem to do this. I found this problem mentioned in bug #28841 however it is marked as wont fix, i cannot see problems like this with tools built upon recent versions of libtitdy, has the issue been fixed since 2004?

Reproduce code:
---------------
<?php
$testHtml = <<<FILTHY

<P></P><TABLE cellSpacing=0 cellPadding=3 width="100%" border=0><TBODY><TR><TD width="65%">
<STRONG><FONT color=#cc9900>persons name <BR></FONT>(occupation)</STRONG></TD>
<TD vAlign=top align=right abbr="" chOff="" headers="" width="45%" background="" ch="" rowSpan=2>
<IMG title="title text" alt="alt text" src="http://www.example.com/image.jpg" border=0 name="img name"></TD>
</TR><TR><TD vAlign=top abbr="" chOff="" headers="" width="65%" background="" ch="">
<P>some text.
<BR></P><P></P></TD></TR></TBODY></TABLE>

FILTHY;

$tidy = new tidy();
$tidyConfig = array('clean'=>true);
$tidy->parseString($testHtml, $tidyConfig);
$tidy->cleanRepair();
$testHtml = (string)$tidy;

var_dump($testHtml);

Expected result:
----------------
Produced from other tools that use libtitdy: (note the style added)


<html>
  <head>
    <title></title>
    <style type="text/css">
 span.c1 {color: #CC9900}
</style>
  </head>
  <body>
    <table cellspacing="0" cellpadding="3" width="100%" border="0">
      <tbody>
        <tr>
          <td width="65%">
            <strong>
            <span class="c1">persons name
            <br /></span> (occupation)</strong>
          </td>
          <td valign="top" align="right" abbr="" choff="" headers=""
          width="45%" background="" ch="" rowspan="2">
            <img title="title text" alt="alt text"
            src="http://www.example.com/image.jpg" border="0"
            name="img name" />
          </td>
        </tr>
        <tr>
          <td valign="top" abbr="" choff="" headers="" width="65%"
          background="" ch="">
            <p>some text.
            <br /></p>
          </td>
        </tr>
      </tbody>
    </table>
  </body>
</html>


Actual result:
--------------
string(589) "<html>
<head>
<title></title>
</head>
<body>
<table cellspacing="0" cellpadding="3" width="100%" border="0">
<tbody>
<tr>
<td width="65%"><strong>persons name<br>
 (occupation)</strong></td>
<td valign="top" align="right" abbr="" choff="" headers="" width=
"45%" background="" ch="" rowspan="2"><img title="title text" alt=
"alt text" src="http://www.example.com/image.jpg" border="0" name=
"img name"></td>
</tr>

<tr>
<td valign="top" abbr="" choff="" headers="" width="65%"
background="" ch="">
<p>some text.<br></p>
</td>
</tr>
</tbody>
</table>
</body>
</html>
"


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-10-25 13:04 UTC] jani@php.net
Quoting that other bug: "This isn't a bug in PHP, it's a bug in the
libtidy library. Please foward this issue on to the developer's there 
to have it taken care of."


 [2008-10-25 22:58 UTC] lukemoynihan at gmail dot com
Are you saying its a bug in the tidy extension, or a bug in libtidy 
itself?
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 14:01:32 2025 UTC