[MDEV-24121] Recent MariaDB update appears to have introduced a DB connection issue for PHP < 7.3 (or anything using PDO) Created: 2020-11-04 Updated: 2023-10-13 Resolved: 2020-11-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Binary Protocol |
| Affects Version/s: | 10.2.35, 10.3.26 |
| Fix Version/s: | 10.2.36, 10.3.27, 10.4.17, 10.5.8 |
| Type: | Bug | Priority: | Major |
| Reporter: | cPanel Senior Tech's | Assignee: | Oleksandr Byelkin |
| Resolution: | Fixed | Votes: | 18 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||
| Description |
|
Possibly related to the recent update: https://mariadb.com/kb/en/mariadb-10235-release-notes/ Sites running PHP 5.6 will see this error:
Sites running PHP 7.0, 7.1, 7.2 will see this error:
Setting the sites to use PHP 7.3, solves the issue. So the recent MariaDB update appears to have introduced a DB connection issue for PHP < 7.3 (or anything using PDO) Another solution is to downgrade. This is also mentioned here: https://xenforo.com/community/threads/mariadb-10-3-26-1-breaks-php-7-2.187331/ |
| Comments |
| Comment by cPanel Senior Tech's [ 2020-11-04 ] | ||||||||||||||||||||||
|
Xenforo: https://xenforo.com/community/threads/mariadb-10-3-26-1-breaks-php-7-2.187331/ | ||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-11-04 ] | ||||||||||||||||||||||
|
It is probably we start strictly check prepared statements attributes, there is probably an error in the code, could you provide something reproducable. Or at least sequence of the commands it perform. | ||||||||||||||||||||||
| Comment by cPanel Senior Tech's [ 2020-11-04 ] | ||||||||||||||||||||||
|
Oleksandr, We have been able to reproduce it with the following snippet (thanks to WHMCS development for providing it):
and it returns the following error:
The system was using
| ||||||||||||||||||||||
| Comment by Daniel Black [ 2020-11-05 ] | ||||||||||||||||||||||
|
stack overflow has upvoted claims on PDO::ATTR_EMULATE_PREPARES true works around the issue. | ||||||||||||||||||||||
| Comment by Daniel Zadnik [ 2020-11-05 ] | ||||||||||||||||||||||
|
The issue isn't exclusive to PHP. Also seeing it with JDBC on MariaDB 10.5.7.
| ||||||||||||||||||||||
| Comment by Alex [ 2020-11-05 ] | ||||||||||||||||||||||
|
The problem with this solution: | ||||||||||||||||||||||
| Comment by Daniel Black [ 2020-11-05 ] | ||||||||||||||||||||||
|
AlexWebLab thanks for the additional information. Btw I wasn't suggesting it was a solution, only that it helped pinpoint the suspicion that sanja already had. Intelli can I assume the MariaDB connector J is unaffected? And for clarification which JDBC version? | ||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-11-05 ] | ||||||||||||||||||||||
|
It looks like some libraries send a byte which mean we will send parameters types even if there is no parameters for the statement at all. So our check takes it as a garbage in the packet. | ||||||||||||||||||||||
| Comment by Mark David [ 2020-11-05 ] | ||||||||||||||||||||||
|
Could reproduce on CentOS 7 using PHP7.2 and MariaDB 10.4.16 (happened after cronjob updated mariadb) | ||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2020-11-05 ] | ||||||||||||||||||||||
|
This was a bug in mysqlnd as in PHP 7.2: https://github.com/php/php-src/blob/PHP-7.2/ext/mysqlnd/mysqlnd_ps_codec.c#L938 Old code generated invalid "execute" packets, they were violating both our (https://mariadb.com/kb/en/com_stmt_execute/) and MySQL (https://dev.mysql.com/doc/internals/en/com-stmt-execute.html) description of the protocol. Latest MariaDB releases have stricter packet validation as a security measure and these broken packets are now rejected. Your best option would be to use PHP 7.3+ that does not violate the protocol. Although we're currently discussing whether to relax the packet validation to allow these invalid packets as a special exception. | ||||||||||||||||||||||
| Comment by mark [ 2020-11-05 ] | ||||||||||||||||||||||
|
hi i use php 5.6 and have the same issue, i would need to re code my whole site to use php7 (as i use mysqlquery), so please release a patch to solve the issue | ||||||||||||||||||||||
| Comment by Oleksandr Byelkin [ 2020-11-05 ] | ||||||||||||||||||||||
|
There will be soon a new release which relax this check. | ||||||||||||||||||||||
| Comment by mark [ 2020-11-05 ] | ||||||||||||||||||||||
|
perfect thank you | ||||||||||||||||||||||
| Comment by Daniel Soares [ 2020-11-05 ] | ||||||||||||||||||||||
|
Hello. | ||||||||||||||||||||||
| Comment by Red Grey [ 2020-11-05 ] | ||||||||||||||||||||||
|
Whats time to fix in new release?? | ||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2020-11-05 ] | ||||||||||||||||||||||
|
days | ||||||||||||||||||||||
| Comment by mark [ 2020-11-05 ] | ||||||||||||||||||||||
|
is there anything we can do for a temp solution until the release? | ||||||||||||||||||||||
| Comment by RedVirus [ 2020-11-05 ] | ||||||||||||||||||||||
|
After many workarounds i tried today this the solutions i got 1- upgrade to php 7.3 or 7.4 2- downgrade to minor version ( mariadb 10.4.16 to 10.4.15)
| ||||||||||||||||||||||
| Comment by Daniel Soares [ 2020-11-05 ] | ||||||||||||||||||||||
|
Thanks, RedVirus. The second solution worked for me (for now)! | ||||||||||||||||||||||
| Comment by RedVirus [ 2020-11-05 ] | ||||||||||||||||||||||
|
@Daniel Soares you are welcome | ||||||||||||||||||||||
| Comment by Red Grey [ 2020-11-05 ] | ||||||||||||||||||||||
|
@redvirus | ||||||||||||||||||||||
| Comment by RedVirus [ 2020-11-05 ] | ||||||||||||||||||||||
|
@Red Grey and exclude specific page from being updated
example for mariadb
this for centos & redhat servers | ||||||||||||||||||||||
| Comment by Daniel Soares [ 2020-11-05 ] | ||||||||||||||||||||||
|
@RedVirus, CentOS. I'll try that. | ||||||||||||||||||||||
| Comment by RedVirus [ 2020-11-05 ] | ||||||||||||||||||||||
|
@Daniel Soares no you dont need to restart anything but for make sure just restart your database server systemctl restart mariadb | ||||||||||||||||||||||
| Comment by Daniel Zadnik [ 2020-11-05 ] | ||||||||||||||||||||||
|
@Daniel Black The software experiencing issues is utilizing mysql-connector-java 5.1.49 (Released Apr 28, 2020). | ||||||||||||||||||||||
| Comment by Rob Brown [ 2020-11-05 ] | ||||||||||||||||||||||
|
I'm using PHP 7.2.x client. Thus the following servers are suddenly BROKEN for me: 10.1.48, 10.2.35, 10.3.26, 10.4.16, 10.5.7 One workaround is to downgrade to one version prior. Unfortunately, upgrading PHP is not an option for me. | ||||||||||||||||||||||
| Comment by Daniel Zadnik [ 2020-11-06 ] | ||||||||||||||||||||||
|
After some further testing, it seems the issue in Java is being triggered by setting the fetch size. This can either be caused by adding "defaultFetchSize=" to the connecting string, or by running it on a statement. For example:
| ||||||||||||||||||||||
| Comment by George L [ 2020-11-06 ] | ||||||||||||||||||||||
|
I can confirm @Sergei Golubchik statement that by backporting PHP 7.3 mysqlnd code outlined to PHP 7.1 and 7.2 fixes the errors for Xenforo and Wordpress at least https://community.centminmod.com/threads/mariadb-10-5-7-10-4-16-10-3-26-10-2-35-and-10-1-48-now-available.20632/#post-86953 allowing PHP 7.2 to work again | ||||||||||||||||||||||
| Comment by Marco Marras [ 2020-11-06 ] | ||||||||||||||||||||||
|
Same Problem with PHP 7.1 PDO::ATTR_EMULATE_PREPARES causes strict conditionals === to fail due to mismatched types. | ||||||||||||||||||||||
| Comment by Lucas Rolff [ 2020-11-09 ] | ||||||||||||||||||||||
|
Since this has been fixed in 10.2.36, 10.3.27 etc - is there an ETA for those being published to the /10.2/, /10.3/ yum repositories? I see the specific version repo is published: http://yum.mariadb.org/10.3.27/centos7-amd64/rpms/ - however, the generic 10.3 repo does not. | ||||||||||||||||||||||
| Comment by Liebert Julien [ 2020-11-09 ] | ||||||||||||||||||||||
|
Since this has been fixed in 10.2.36, 10.3.27 etc - is there an ETA for those being published to Dockerhub mariadb official image ? | ||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2020-11-10 ] | ||||||||||||||||||||||
|
MariaDB official images are not maintained by MariaDB, you need to ask the maintainer of the images. | ||||||||||||||||||||||
| Comment by Daniel Black [ 2020-11-11 ] | ||||||||||||||||||||||
|
For all those watching patiently, there have been packages released https://mariadb.org/mariadb-10-5-8-10-4-17-10-3-27-and-10-2-36-now-available/ | ||||||||||||||||||||||
| Comment by Daniel Black [ 2020-11-12 ] | ||||||||||||||||||||||
|
jliebert with the mariadb release, the docker library official images picked up the release and pushed their release |