From: johnfivealive at hotmail dot com
Operating system: Fedora Core 2
PHP version: 5.0.0RC3
PHP Bug Type: Unknown/Other Function
Bug description: Tidy extension causing aborted MySQL connections
Description:
------------
Whenever I execute a MySQL query I call my escapeString function to escape
strings properly before inserting them into the database. When I call the
tidy_repair_string function from my escapeString function, I start seeing
the following error in the MySQL error log:
Aborted connection 199 to db: 'logik' user: 'logik' host: `localhost' (Got
an error reading communication packets)
This error only seems to occur when I'm attempting to execute a lot of
queries in succession, for example importing a large XML file into my
database.
I think there is some bug between PHP and the Tidy extension. Perhaps Tidy
is taking too long to return or their are some thread synchronization
issues which are causing MySQL to malfunction. I'm pretty sure it is the
Tidy extension that is causing problems here because when I comment out
the call to tidy_repair_string my program works with no problems
whatsoever.
Tidy info as reported by phpinfo():
tidy
Tidy support enabled
libTidy Release 1st June 2004
Extension Version 2.0-dev ($Id: tidy.c,v 1.53 2004/05/28 20:32:52 john
Exp $)
Reproduce code:
---------------
This is how I'm calling tidy_repair_string:
public static function tidyString( $string )
{
$tidyOptions = array( "bare" => true,
"break-before-br" => true,
"char-encoding" => "latin1",
"clean" => true,
"doctype" => "omit",
"drop-proprietary-attributes" => true,
"logical-emphasis" => false,
"output-xhtml" => true,
"quote-ampersand" => true,
"show-body-only" => true,
"word-2000" => true,
"wrap" => 0 );
// Get rid of all funky characters
return tidy_repair_string( $string, $tidyOptions ); // PHP 5
}
Expected result:
----------------
Tidy should work in sequence with MySQL queries.
Actual result:
--------------
The correct string is returned, but when queries need to be executed
quickly and in succession things start getting erratic and MySQL says:
Aborted connection 199 to db: 'logik' user: 'logik' host: `localhost' (Got
an error reading communication packets)
Also PHP outputs the following warning:
Warning: Unknown list entry type in request shutdown (18545152) in Unknown
on line 0
Other times, the script never finishes executing, thus no output is
produced, warnings or otherwise.
There are also MySQL warnings, but these are a result of Tidy not
returning the correct string, or perhaps not returning in time.
When I don't call the tidy function, there are not warnings or problems.
--
Edit bug report at http://bugs.php.net/?id=28763&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=28763&r=trysnapshot4
Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=28763&r=trysnapshot5
Fixed in CVS: http://bugs.php.net/fix.php?id=28763&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=28763&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=28763&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=28763&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=28763&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=28763&r=support
Expected behavior: http://bugs.php.net/fix.php?id=28763&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=28763&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=28763&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=28763&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=28763&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=28763&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=28763&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=28763&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=28763&r=float