Bug #71290 [Com]: PDO::query() throws both an error and an exception if server has gone away
| From: | jurchiks101 at gmail dot com | Date: | Mon, 01 Feb 2016 15:58:34 +0000 |
| Subject: | Bug #71290 [Com]: PDO::query() throws both an error and an exception if server has gone away | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-198989@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71290&edit=1
ID: 71290
Comment by: jurchiks101 at gmail dot com
Reported by: jurchiks101 at gmail dot com
Summary: PDO::query() throws both an error and an exception
if server has gone away
Status: Not a bug
Type: Bug
Package: PDO MySQL
Operating System: Windows 7 x64
PHP Version: 5.6Git-2016-01-05 (Git)
Block user comment: N
Private report: N
New Comment:
Yeeeah, I'm not going to compile PHP on Windows, that is waaay too much hassle; not nearly as
easy as on Linux.
So I guess it's mysqlnd that should be fixed then.
Previous Comments:
------------------------------------------------------------------------
[2016-02-01 15:37:20] willfitch@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
This is a result of the pdo_mysql driver using mysqlnd (MySQL native driver). pdo_mysql
doesn't have control over the warnings thrown by mysqlnd.
If want to get around this, you'll need to compile pdo_mysql against a different MySQL library.
Your OS indicates Windows, so you'll want to compile against the mysql_config like so:
configure --enable-pdo --with-pdo-mysql=C:\path\to\mysql\bin\mysql_config
--with-mysqli=C:\path\to\mysql\bin\mysql_config
I am not very familiar with compiling PHP on Windows, so have a look at the documentation starting
here: https://wiki.php.net/internals/windows/stepbystepbuild.
------------------------------------------------------------------------
[2016-01-05 17:11:30] jurchiks101 at gmail dot com
Description:
------------
PHP version: http://windows.php.net/snapshots/ PHP
5.6 Revision: r227c898 (January 04 2016, 03:00:00) VC11 x86 Non Thread Safe
I would have tried PHP 7 as well, but your PHP 7 Windows builds have incompatible extension API
versions, for which I have already created a bug report. Also, there are no PHP 7 snapshots for
Windows.
All I did was download and extract the PHP snapshot, rename php.ini-development to php.ini, enable
extension=pdo_mysql.dll, and run
php.exe test.php with the script from the Gist.
Test script:
---------------
https://gist.github.com/jurchiks/c8fff1e5ec8c97005425
Expected result:
----------------
There should be no error output since PDO::ATTR_ERRMODE is set to ERRMODE_EXCEPTION.
Actual result:
--------------
Both error and exception are output.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71290&edit=1