Bug #76525 [NEW]: mysqli::commit does not throw if MYSQLI_REPORT_ERROR enabled and mysqlnd used

From: Date: Mon, 25 Jun 2018 08:35:45 +0000
Subject: Bug #76525 [NEW]: mysqli::commit does not throw if MYSQLI_REPORT_ERROR enabled and mysqlnd used
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215962@lists.php.net to get a copy of this message
From: willem at mollie dot nl Operating system: Debian PHP version: 7.1.19 Package: MySQLi related Bug Type: Bug Bug description:mysqli::commit does not throw if MYSQLI_REPORT_ERROR enabled and mysqlnd used Description: ------------ We experienced lost data because the mysqli::commit() function does not throw under some conditions if mysqlnd is used. We configured mysqli to use report_mode = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT. We use a MySQL Galera cluster setup and during reboots of nodes deadlocks in the commit query can occur. However, these deadlocks do not cause an exception to be thrown if the ::commit() method is used. Instead, false is returned. In practice, the call fails silently. Sending COMMIT queries manually works as expected (an exception is thrown on a dead lock). You can see in https://github.com/php/php-src/blob/5f54f48024783df739dd5bbec64cb74063fefa06/ext/mysqli/mysqli_api.c#L741 that the error handling is missing for mysqlnd if you compare to https://github.com/php/php-src/blob/5f54f48024783df739dd5bbec64cb74063fefa06/ext/mysqli/mysqli_api.c#L1579. I'd guess that the MYSQLI_REPORT_MYSQL_ERROR macro is missing. Expected result: ---------------- If the commit() method encounters a "Deadlock found when trying to get lock; try restarting transaction" error (1213 code), with report_mode = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT we expect it to throw mysqli_sql_exception. Actual result: -------------- False is returned, e.g. the report_mode is ignored. -- Edit bug report at https://bugs.php.net/bug.php?id=76525&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=76525&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=76525&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=76525&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=76525&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=76525&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=76525&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=76525&r=needscript Try newer version: https://bugs.php.net/fix.php?id=76525&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=76525&r=support Expected behavior: https://bugs.php.net/fix.php?id=76525&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=76525&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=76525&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=76525&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=76525&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=76525&r=dst IIS Stability: https://bugs.php.net/fix.php?id=76525&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=76525&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=76525&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=76525&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=76525&r=mysqlcfg

« previous php.bugs (#215962) next »