php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42371 PDO doesn`t throw Exception when querying MySQL Server 4.0.16 (Mysql 5 works!)
Submitted: 2007-08-22 08:45 UTC Modified: 2008-09-23 01:00 UTC
Votes:5
Avg. Score:4.2 ± 1.0
Reproduced:3 of 3 (100.0%)
Same Version:1 (33.3%)
Same OS:0 (0.0%)
From: songqi at baidu dot com Assigned: andrey (profile)
Status: No Feedback Package: PDO related
PHP Version: 5.2.3 OS: Redhat linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: songqi at baidu dot com
New email:
PHP Version: OS:

 

 [2007-08-22 08:45 UTC] songqi at baidu dot com
Description:
------------
PDO doesn`t throw Exception when querying a sql with syntax error as expected.

MySQL Client Version: 5.0.45
MySQL Server Version: 4.0.16

But if I connect to a MySQL5 server, it throws Exception correctly.

Same error happened in php-5.2.2

Reproduce code:
---------------
$dbt = new PDO("mysql:host=xxx;port=xxx;dbname=xxx",'xxx','xxx');
$dbt->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$a = $dbt->query("what happened?");

Expected result:
----------------
PDO should throw a Exception

Actual result:
--------------
nothing is throwed

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-08-24 10:32 UTC] jani@php.net
Andrey, any ideas about this? Seems more like an issue outside PHP..
 [2007-10-05 14:54 UTC] mpub at meiners-online dot de
I also use PHP 5 and MySQL 4 and had the same problem. When I use PHPMyAdmin it says "Your PHP MySQL library version 5.0.18 differs from your MySQL server version 4.0.27. This may cause unpredictable behavior." This confirms the existence of the problem. It seems to be a well-known problem. Otherwise it could be useful to contact the developers of PHPMyAdmin to find out more about their experiences.
 [2007-10-08 10:55 UTC] mpub at meiners-online dot de
If the different client- and server-versions are simply not meant to be compatible and it isn't a bug, it seems useful to me to raise an E_WARNING or E_NOTICE. This could help a lot of people by warning them.
 [2008-09-23 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC