Doc #65465 [NEW]: passing ArrayAccess to PDO constructor
| From: | gongteng524702837 at gmail dot com | Date: | Sat, 17 Aug 2013 13:16:34 +0000 |
| Subject: | Doc #65465 [NEW]: passing ArrayAccess to PDO constructor | ||
| Groups: | php.doc.bugs | ||
| Request: | Send a blank email to doc-bugs+get-10170@lists.php.net to get a copy of this message | ||
From: gongteng524702837 at gmail dot com
Operating system: linux 64bit
PHP version: 5.5.2
Package: PDO related
Bug Type: Documentation Problem
Bug description:passing ArrayAccess to PDO constructor
Description:
------------
Passing object that implement ArrayAccess interface to PDO
constructor(forth
param), the constructor will return NULL, no Exception raised.
(Iâm not sure is the bug come from PDO or ArrayAccess.)
Test script:
---------------
$config = array(...);
$options = new SomeObjImplArrAcc(); // just an empty object
$pdo = new
PDO($config['dsn'],$config['user'],$config['pass'],$options);
var_dump($pdo); // <- NULL
$options[PDO::ATTR_PERSISTENT] = true; // or have some elements
$pdo = new
PDO($config['dsn'],$config['user'],$config['pass'],$options);
var_dump($pdo); // <- NULL
// but success if convert to "native" array
$pdo = new
PDO($config['dsn'],$config['user'],$config['pass'],(array)$options);
var_dump($pdo); // <- {PDO}[0]
Expected result:
----------------
construct three same PDO object
--
Edit bug report at https://bugs.php.net/bug.php?id=65465&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=65465&r=trysnapshot54
Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=65465&r=trysnapshot53
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=65465&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=65465&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=65465&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=65465&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=65465&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=65465&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=65465&r=support
Expected behavior: https://bugs.php.net/fix.php?id=65465&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=65465&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=65465&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=65465&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65465&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=65465&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=65465&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=65465&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65465&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=65465&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=65465&r=mysqlcfg