Bug #73865 [Opn->Fbk]: extending PDO conflict with persistent connections
| From: | cmb@php.net | Date: | Wed, 03 Mar 2021 12:24:47 +0000 |
| Subject: | Bug #73865 [Opn->Fbk]: extending PDO conflict with persistent connections | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-232501@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
Updated by: cmb@php.net
Reported by: gpkappos at ucy dot ac dot cy
Summary: extending PDO conflict with persistent connections
-Status: Open
+Status: Feedback
Type: Bug
Package: PDO OCI
Operating System: Windows 10
PHP Version: 5.6.29
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
I have no OCI setup to test this, but I don't think it's driver
specific behavior, and for PDO_MYSQL, PDO_SQLITE and PDO_ODBC I
get the expected result. Or can you still reproduce this with any
of the actively supported PHP versions[1]?
[1] <https://www.php.net/supported-versions.php>
Previous Comments:
------------------------------------------------------------------------
[2017-01-11 07:02:54] gpkappos at ucy dot ac dot cy
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);
?>
------------------------------------------------------------------------
[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