Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-16334

Database connection shouldn't be closed twice with MySQL/MySQLi backends

    XMLWordPrintable

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Medium Medium
    • 4.3.0beta2
    • 4.1.4, 4.2.0, 4.3.0beta1
    • Misc
    • None

    Description

      Running the testsuite with mysqli:// and with Xdebug loaded (1) generates an "E" at every test with a message like:
      mysqli_close(): Couldn't fetch mysqli

      Without a master/slave configuration, the connection is initiated once and closed twice by the eZMySQL(i?)DB::close() function which causes a PHP error.

      The error doesn't appear using mysql:// for the reason that an issue exist with the mysql functions and copying the link by reference (which is still the case in /lib/ezdb/classes/ezmysqldb.php:96):

      The following code snippet will not issue an error

      $c = mysql_connect('localhost', 'root', '*****' );
      $d =& $c;
      $e = $d;
      
      mysql_close( $d );
      mysql_close( $c );
      

      Commenting: $e = $d and running this code again will give you the (expected) error:
      Warning: mysql_close(): 4 is not a valid MySQL-Link resource in /home/patrick.allaert/test.php on line 7

      (1) the fact that it doesn't produce an error without Xdebug inside ezp code is completely unknown. The above test case works consistently with or without Xdebug loaded.

      Attachments

        Activity

          People

            patrick.allaert patrick.allaert
            patrick.allaert patrick.allaert
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: