From: ai at artem dot cc
Operating system: Centos
PHP version: 5.4.17
Package: PDO related
Bug Type: Bug
Bug description:PDOStatement::fetchAll wrong result
Description:
------------
When the mysqlnd driver is used PDOStatement->fetchAll(PDO::FETCH_COLUMN |
PDO::FETCH_UNIQUE, 0) does not return proper results when
PDO::ATTR_STRINGIFY_FETCHES and PDO::ATTR_EMULATE_PREPARES set to 0
Test script:
---------------
$pdo = new PDO('mysql:host=127.0.0.1;dbname=test', 'root', '123');
$pdo->setAttribute(PDO::ATTR_STRINGIFY_FETCHES, 0);
$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, 0);
var_dump($pdo->query("SELECT id FROM test")->fetchAll(PDO::FETCH_COLUMN |
PDO::FETCH_UNIQUE, 0));
Expected result:
----------------
array(2) {
[1]=>
int(1)
[2]=>
int(2)
}
Actual result:
--------------
array(1) {
[""]=>
int(2)
}
--
Edit bug report at https://bugs.php.net/bug.php?id=65287&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=65287&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=65287&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=65287&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65287&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65287&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65287&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65287&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65287&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65287&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65287&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=65287&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=65287&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65287&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65287&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65287&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65287&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65287&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65287&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65287&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65287&r=mysqlcfg