From:             sergey at shymko dot net
Operating system: Linux
PHP version:      5.3.19
Package:          PDO related
Bug Type:         Bug
Bug description:PDO Triggers Warning(s) Regardless of Error Handling Strategy

Description:
------------
PDO triggers warning(s) regardless of the chosen error handling strategy 
http://php.net/manual/en/pdo.error-handling.php

Environment:
- mysql  Ver 14.14 Distrib 5.5.22, for Linux (x86_64) using  EditLine
wrapper

Test script:
---------------
<?php

$adapter = new PDO('mysql:host=localhost;db_name=test', 'root', '');

$adapter->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
assert($adapter->getAttribute(PDO::ATTR_ERRMODE) ===
PDO::ERRMODE_EXCEPTION);

$waitTimeout = 1;

$adapter->exec("SET @@session.wait_timeout = {$waitTimeout}");
$statement = $adapter->query('SELECT @@session.wait_timeout');
assert($statement->fetchColumn() == $waitTimeout);

/**
 * Ensure 'MySQL server has gone away' conditions are met
 */
sleep($waitTimeout + 1);

$adapter->query('SELECT 1');


Expected result:
----------------
- PDOException with message 'SQLSTATE[HY000]: General error: 2006 MySQL
server 
has gone away'
- No warnings (because of the chosen PDO error handling strategy)

Actual result:
--------------
1. When connection type is TCP/IP:
   1. Warning: PDO::query() [pdo.query]: MySQL server has gone away
   2. Warning: PDO::query() [pdo.query]: Error reading result set's header
1'. When connection type is Unix socket:
   1. Warning: Error while sending QUERY packet. PID=18586
2. PDOException with message 'SQLSTATE[HY000]: General error: 2006 MySQL
server 
has gone away'

-- 
Edit bug report at https://bugs.php.net/bug.php?id=63812&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=63812&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=63812&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=63812&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=63812&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=63812&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=63812&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=63812&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=63812&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=63812&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=63812&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=63812&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=63812&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=63812&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63812&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=63812&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=63812&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=63812&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=63812&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=63812&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=63812&r=mysqlcfg

Reply via email to