From: d dot voice at gmx dot com Operating system: RH Linux PHP version: 5.3.14 Package: Output Control Bug Type: Bug Bug description:Incorrect injection of html markup
Description: ------------ Tidy seems to injecting markup to unexpected places. As can be seen from the below code. There's a place where I have an orphan closing </i> tag within an unclosed paragraph tag. <p>paragraph</i><p/> It's injecting the following markup within the paragraph tags: <span style="padding:10px"> Tidy package info: Tidy support => enabled libTidy Release => 14 June 2007 Extension Version => 2.0 ($Id: tidy.c,v 1.66.2.8.2.26 2008/12/31 11:17:46 sebastian Exp $) Short code snippet to reproduce the bug - please see below. List of modules: --with-apxs2=/usr/local/apache2/bin/apxs' '--with-zlib=/usr' '--with-pspell=/usr' '--prefix=/usr' '--with-config-file-path=/etc' '--libexecdir=/usr/libexec' '--with-curl' '--enable-memory-limit' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-iconv' '--with-expat-dir=/usr' '--enable-magic-quotes' '--enable-track-vars' '--enable-dio' '--without-sqlite' '--with-xml2' '--with-xmlrpc' '--enable-pcntl' '--disable-debug' '--enable-inline-optimization' '--enable-mbstring' '--enable-mm=shared' '--enable-safe-mode' '--enable-trans-sid' '--enable-wddx=shared' '--enable-xml' '--with-regex=system' '--with-xsl' '--with-tidy=/usr Test script: --------------- <?php $html = ' <html> <head> <title>test</title> </head> <body> & <div Hello world again <div> <span style="padding:10px"> There are 12 columns in the grid Hello world<br> </div> <p>paragraph</i><p/> </body> </html>'; // Specify configuration $config = array( 'indent' => true, 'output-xhtml' => true, 'wrap' => 200, 'clean' => true, 'bare' => true, 'preserve-entities' => true ); $tidy = new tidy(); $clean = $tidy->repairString($html, $config, 'utf8'); // Output echo $clean; ?> Expected result: ---------------- Expected result: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> test </title> </head> <body> & <div hello="" world="" again=""></div> <div> <span style="padding:10px">There are 12 columns in the grid Hello world<br /></span> </div> <p> paragraph </p> </body> </html> However in an dream world where computers know what I want - this statement would also be - <div hello="" world="" again=""></div> changed to this: <div> hello world again </div> Actual result: -------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title> test </title> </head> <body> & <div hello="" world="" again=""></div> <div> <span style="padding:10px">There are 12 columns in the grid Hello world<br /></span> </div> <p> <span style="padding:10px">paragraph</span> </p> </body> </html> -- Edit bug report at https://bugs.php.net/bug.php?id=62365&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62365&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62365&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62365&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=62365&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62365&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=62365&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=62365&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=62365&r=needscript Try newer version: https://bugs.php.net/fix.php?id=62365&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=62365&r=support Expected behavior: https://bugs.php.net/fix.php?id=62365&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=62365&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=62365&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=62365&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62365&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=62365&r=dst IIS Stability: https://bugs.php.net/fix.php?id=62365&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=62365&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=62365&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=62365&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=62365&r=mysqlcfg