Edit report at https://bugs.php.net/bug.php?id=71863&edit=1
ID: 71863
Updated by: andrey@php.net
Reported by: Azq2 at ya dot ru
Summary: Segfault when EXPLAIN with "Unknown column" error
-Status: Assigned
+Status: Closed
Type: Bug
Package: MySQLi related
Operating System: Ubuntu 14.04
PHP Version: master-Git-2016-03-20 (Git)
Assigned To: andrey
Block user comment: N
Private report: N
New Comment:
The fix for this bug has been committed.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
For Windows:
http://windows.php.net/snapshots/
Thank you for the report, and for helping us make PHP better.
Just pushed the fix to 7.1 and master
Previous Comments:
------------------------------------------------------------------------
[2016-07-22 20:55:47] andrey@php.net
Here is an example of MariaDB. A test from the suite fails. Why? Because they changed a text
message, which is not that weird, but they changed the ID of the error.
001+ int(2)
002+ int(1146)
003+ string(39) "Table 'mysql.table_stats' doesn't exist"
001- int(1)
002- int(1051)
003- %unicode|string%(%d) "Unknown table %snot_exists%s"
------------------------------------------------------------------------
[2016-07-22 20:42:35] andrey@php.net
MariaDB bends the protocol and this is why this happened. I am preparing a fix for this. The crash
happens because of a bug of mine of not initializing correctly callbacks for the error structure.
Reporting an error after reporting that there is no error is very rare case, which I saw last time
in 2007 (see http://bugs.mysql.com/bug.php?id=27876 :)
mysqlnd should not crash, that is for sure.
------------------------------------------------------------------------
[2016-07-22 20:26:45] reyad dot attiyat at gmail dot com
This segfault only happens in PHP 7.1 and not in previous versions of PHP. I understand that mysqlnd
only supports the official MySQL implementation, but don't believe we should have a separate
driver for MariaDB or other forks (like AWS Aurora). Do you think we should add a quirk/flag to the
mysqlnd driver for MariaDB that would handle these errors correctly?
------------------------------------------------------------------------
[2016-07-22 20:03:56] andrey@php.net
MySQL sends an error directly after the query is executed, as it should happen. MariaDB does send
OK, meaning that there are fields and sends meta for 10 fields, then EOF (marking end of metadata)
and only then it sends an error message. Such sending of errors is not common. It exists when we
talk calling stored procedures because they can fail in the middle after some meta is sent.
------------------------------------------------------------------------
[2016-07-19 19:10:20] andrey@php.net
I confirm a segfault with MariaDB 10.1.16 . Will have to check how it is incompatible with the MySQL
client server protocol.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=71863
--
Edit this bug report at https://bugs.php.net/bug.php?id=71863&edit=1