From:             brice dot joly at free dot fr
Operating system: Windows XP
PHP version:      5.1.2
PHP Bug Type:     PDO related
Bug description:  Procedure call + PDO::ATTR_PERSISTENT => true

Description:
------------
When calling a procedure from PDO with PDO::ATTR_PERSISTENT = true, I have
a very strange behaviour when refreshing the page: on odd tries it works as
expected, on even ones PDO makes the call, then loses connection while
retrieving the result. Direct and prepared call both produce the same
behaviour. Note that the call is actually ran by MySQL in both cases
(appears in the query log).

When switching PDO::ATTR_PERSISTENT to false all works as expected.

Running the test with PHP CLI works fine. I run PHP (tested with snapshot
of 17 Feb 2006, 5.1.3-dev, had the same problem with 5.1.2) as a module,
Apache 2.0.52, MySQL 5.0.18.

Reproduce code:
---------------
// MySQL Procedure
CREATE PROCEDURE test.simpleTest()
BEGIN
  SELECT 'Procedure output';
END;

// PDO call
<?php
$dbh = new PDO('mysql:host=localhost;dbname=test', 'user', 'password',
array(PDO::ATTR_PERSISTENT => true);

foreach ($dbh->query("CALL simpleTest()") as $row) {
    print_r($row);
}
$arr = $dbh->errorInfo();
print_r($arr);

/* Same problem with
$stmt = $dbh->prepare("CALL simpleTest()");
$stmt->execute();
foreach ($stmt->fetchAll(PDO::FETCH_ASSOC) as $row) {
    print_r($row);
}
$arr = $stmt->errorInfo();
print_r($arr);
*/
?>

Expected result:
----------------
Array
(
    [Procedure output] => Procedure output
    [0] => Procedure output
)
Array
(
    [0] => 00000
)

on odd and even tries/refresh

Actual result:
--------------
On odd tries (1st, 3rd, etc.):

Array
(
    [Procedure output] => Procedure output
    [0] => Procedure output
)
Array
(
    [0] => 00000
)

on even tries (refresh)
Array
(
    [0] => HY000
    [1] => 2013
    [2] => Lost connection to MySQL server during query
)

-- 
Edit bug report at http://bugs.php.net/?id=36449&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36449&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36449&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36449&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=36449&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=36449&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=36449&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=36449&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=36449&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=36449&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=36449&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=36449&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=36449&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=36449&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36449&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=36449&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=36449&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=36449&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36449&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=36449&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=36449&r=mysqlcfg

Reply via email to