php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28763 Tidy extension causing aborted MySQL connections
Submitted: 2004-06-13 18:02 UTC Modified: 2004-06-22 01:00 UTC
From: johnfivealive at hotmail dot com Assigned:
Status: No Feedback Package: Tidy (PECL)
PHP Version: 5.0.0RC3 OS: Fedora Core 2
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2004-06-13 18:02 UTC] johnfivealive at hotmail dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-14 01:39 UTC] curt@php.net
Check you mysql settings:
http://dev.mysql.com/doc/mysql/en/Communication_errors.html
 [2004-06-22 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Thu Sep 23 12:03:37 2021 UTC