php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56975 PDO_MySQL incorrectly detects MySQL 4.0
Submitted: 2006-04-24 23:35 UTC Modified: 2006-04-25 12:13 UTC
From: phyre at rogers dot com Assigned:
Status: Closed Package: PDO_MYSQL (PECL)
PHP Version: 5.1.2 OS: Debian Linux 3.1
Private report: No CVE-ID: None
 [2006-04-24 23:35 UTC] phyre at rogers dot com
Description:
------------
PDO Driver for MySQL, client library version: 4.1.11
MySQL Server: MySQL 4.0.24

Reproduce code:
---------------
try {
$dbc = new PDO ("mysql:host=myhost;dbname=mydb", "myuser", "mypass");
$dbc->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
} catch (PDOException $e) {
echo $e->getMessage();
}
echo $dbc->getAttribute(PDO::ATTR_CONNECTION_STATUS)."\n";

$strsql = "SELECT * FROM `ewcms_article`";

$dbq = $dbc->query($strsql);
if ($dbq === false) echo "false\n";
echo getType($dbq)."\n";

print_r($dbc->errorInfo());
echo "\n".$dbc->getAttribute(PDO::ATTR_CONNECTION_STATUS);

Expected result:
----------------
This should not return false and instead return the proper PDOStatement object.  It seems that it's not checking for MySQL 4.0 before executing the prepare statements (or so I guess) and is failing with an 'unknown command' error.

Also, there is no warning or exception thrown at all from this failure of the query.

Actual result:
--------------
myhost via TCP/IP
false
boolean
Array
(
    [0] => 00000
    [1] => 1047
    [2] => Unknown command
)

myhost via TCP/IP

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-25 01:29 UTC] wez@php.net
Please try a 5.1.x snapshot from http://snaps.php.net.
This issue should already be fixed there.
 [2006-04-25 12:13 UTC] phyre at rogers dot com
Backported php5.1-200604251430's pdo and pdo_mysql into the 5.1.2 source tree and compiled the modules.

Works like a charm in this test case, correctly returning a result.

Thanks very much.
-M
 [2006-05-29 15:04 UTC] spam01 at pornel dot net
I've got the same error with PHP6.0-dev.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Dec 04 11:01:30 2024 UTC