Bug #73865 [Fbk->Opn]: extending PDO conflict with persistent connections

From: Date: Wed, 11 Jan 2017 07:02:57 +0000
Subject: Bug #73865 [Fbk->Opn]: extending PDO conflict with persistent connections
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-206504@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73865&edit=1 ID: 73865 User updated by: gpkappos at ucy dot ac dot cy Reported by: gpkappos at ucy dot ac dot cy Summary: extending PDO conflict with persistent connections -Status: Feedback +Status: Open Type: Bug Package: PDO OCI Operating System: Windows 10 PHP Version: 5.6.29 Block user comment: N Private report: N New Comment: Hello, thank you for your reply. Here is the script, it uses oracle instant client and an oracle database but no tables are needed, just a connection: <?php class A extends \PDO { public function __construct() { parent::__construct('oci:dbname=//<dbserver1>:1521/<servicename1>;charset=AL32UTF8', 'scott', 'tiger', [PDO::ATTR_PERSISTENT => true]); } } class B extends \PDO { public function __construct() { parent::__construct('oci:dbname=//<dbserver1>:1521/<servicename1>;charset=AL32UTF8', 'scott', 'tiger', [PDO::ATTR_PERSISTENT => true]); } } $a = new A(); var_dump($a); $b = new B(); var_dump($b); ?> Previous Comments: ------------------------------------------------------------------------ [2017-01-11 04:57:50] krakjoe@php.net Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. ------------------------------------------------------------------------ [2017-01-05 06:22:16] gpkappos at ucy dot ac dot cy Description: ------------ When extending PDO, if you use persistent connections you can only create instances of the first object that uses the connection. In the example below the constructor for B returns an instance of A Test script: --------------- class A extends \PDO { public function __construct() { parent::__construct('oci:dbname=//dbserver.example.org:1521/dbserver.example.org;charset=AL32UTF8', 'test', 'testpw', [PDO::ATTR_PERSISTENT => true]); } } class B extends \PDO { public function __construct() { parent::__construct('oci:dbname=//dbserver.example.org:1521/dbserver.example.org;charset=AL32UTF8', 'test', 'testpw', [PDO::ATTR_PERSISTENT => true]); } } $a = new A(); var_dump($a); $b = new B(); var_dump($b); Expected result: ---------------- object(A)[1] object(B)[2] Actual result: -------------- object(A)[1] object(A)[2] ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=73865&edit=1

« previous php.bugs (#206504) next »