Bug #78179 [Opn->Ana]: MariaDB 10.3 broke mysqli::begin_transaction()

From: Date: Sun, 21 Jul 2019 17:43:34 +0000
Subject: Bug #78179 [Opn->Ana]: MariaDB 10.3 broke mysqli::begin_transaction()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221879@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78179&edit=1 ID: 78179 Updated by: requinix@php.net Reported by: david dot bergeron5 at usherbrooke dot ca Summary: MariaDB 10.3 broke mysqli::begin_transaction() -Status: Open +Status: Analyzed Type: Bug Package: MySQLi related Operating System: Debian 9 PHP Version: Irrelevant Block user comment: N Private report: N New Comment: What does mysqli_get_server_version($mysqli) or $mysqli->server_version return? 50505 I assume? And this has been the case since MariaDB 10.0, right? It's not new? Because, to fill in the blanks that @duckwebdev saw, MariaDB returns a half-hardcoded version number (string) like "5.5.5-10.5.0". Which is a nuisance - it should be faking the corresponding MySQL version, not a fixed 5.5.5. Which is to say nothing about how hacky this was to fix the original problem. Sigh. https://github.com/MariaDB/server/blob/826f9d4f7e99973cafe7654697d7c50b8b64b76b/include/mysql_com.h#L41 PHP could detect the magic "5.5.5-" string as their client does, but the truth is that since 10.0 their versioning scheme is incompatible with MySQL's. Like how 10.0 is based on the 5.6 series and so does not support 5.7 (or future) features, even though 10.0 >= 5.7. Which means to get it absolutely right PHP would need different version number checks; for example, transactions' READ WRITE/READ ONLY requires MySQL 5.6.5, which presumably will be somewhere (I can't find where) in the MariaDB 10.0 *and* 10.1 series. Double sigh. ...why couldn't they have done it properly like Percona... Or... we could sweep the issue under the rug and remove version checks for older stuff - after all 5.6.5 was released April 2012, which is back in the PHP 5.3 era. Previous Comments: ------------------------------------------------------------------------ [2019-07-21 16:28:11] duckwebdev at gmail dot com Same issue even when using two different configurations. It would appear Oracle made their own bug report and properly fixed their code too: https://bugs.mysql.com/bug.php?id=68187 Configuration 1: ---------------------- MariaDB Version: 10.1.35 PHP version: 7.2.16 OS: CentOS 7 Configuration 2: ---------------------- MariaDB Version: 10.1.37 PHP version: 7.2.12 OS: Win10 Recommendation: ----------------------- Follow in MariaDB's footsteps and check for the fake version number, then remove if it exists. See MariaDB's sql-common/client.c: https://github.com/MariaDB/server/commit/c50ee6c23dbeb090963580754bec2f0a96ac0557#diff-5b45fa673c88c06a9651c7906364f592 ------------------------------------------------------------------------ [2019-06-26 03:11:49] 4275556 at qq dot com I met the same problem just now. mariadb 10.4 Centos 7 php5.6 mysqli::begin_transaction(): This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required in /data/BPlatform/common/lock/MySqliLock.php on line 53 it was good before upgrading to mariadb 10.4 (was mysql 5.6) ------------------------------------------------------------------------ [2019-06-18 19:27:49] david dot bergeron5 at usherbrooke dot ca Description: ------------ MariaDB Version 10.3.15-MariaDB-1:10.3.15+maria~stretch PHP Version: PHP version: 7.0.33-0+deb9u3 With MariaDB 10.3 they remove the innoDB version reporting. I think this is due to this issue in MariaDB. https://jira.mariadb.org/browse/MDEV-16172 So when you do a $db->begin_transaction(MYSQLI_TRANS_START_READ_WRITE); You receive a "PHP Warning: mysqli::begin_transaction(): This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required in /var/www/html/..." Test script: --------------- $host="localhost"; $username="username"; $password="password"; $database="yourdatabase"; $db = new mysqli( $host, $username, $password, $database); $db->begin_transaction(MYSQLI_TRANS_START_READ_WRITE); Expected result: ---------------- Should not say that this doesn't support 'READ WRITE'. Actual result: -------------- PHP Warning: mysqli::begin_transaction(): This server version doesn't support 'READ WRITE' and 'READ ONLY'. Minimum 5.6.5 is required in /var/www/html/dbtest.php on line 8 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78179&edit=1

« previous php.bugs (#221879) next »