php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47407 There can be only one PDO (derived) instance with ATTR_PERSISTENT
Submitted: 2009-02-16 12:53 UTC Modified: 2014-05-27 06:29 UTC
Votes:2
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: dennis at born05 dot nl Assigned: laruence (profile)
Status: Closed Package: PDO Core
PHP Version: 5.2, 5.3, trunk OS: Fedora Core 6
Private report: No CVE-ID: None
 [2009-02-16 12:53 UTC] dennis at born05 dot nl
Description:
------------
When you create 2 or more instances of PDO (or derived) with 
ATTR_PERSISTENT you end up with several references to only one 
object.

Reproduce code:
---------------
<?php
class MyPDO extends PDO {}

$bar = new PDO("sqlite::memory:", null, null, array(PDO::ATTR_PERSISTENT => true));
$baz = new MyPDO("sqlite::memory:", null, null, array(PDO::ATTR_PERSISTENT => true));

var_dump ($bar);
var_dump ($baz);
?>

Expected result:
----------------
object(PDO)#1 (0) {
}
object(MyPDO)#2 (0) {
}






Actual result:
--------------
object(MyPDO)#1 (0) {
}
object(MyPDO)#2 (0) {
}






Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-06-21 23:47 UTC] felipe@php.net
-PHP Version: 5.2CVS-2009-02-16 (snap) +PHP Version: 5.2, 5.3, trunk
 [2010-06-21 23:47 UTC] felipe@php.net
5.2SVN:
object(MyPDO)#1 (0) {
}
object(MyPDO)#2 (0) {
}
[Mon Jun 21 18:46:40 2010]  Script:  '../bug.php'
/home/felipe/dev/php5_2/ext/pdo/pdo_dbh.c(1517) :  Freeing 0x0864D85C (44 bytes), script=../bug.php
[Mon Jun 21 18:46:40 2010]  Script:  '../bug.php'
/home/felipe/dev/php5_2/ext/pdo/pdo_dbh.c(1518) :  Freeing 0x0864ED0C (32 bytes), script=../bug.php
/home/felipe/dev/php5_2/Zend/zend_alloc.c(2391) : Actual location (location was relayed)
=== Total 2 memory leaks detected ===


5.3SVN:
object(PDO)#1 (0) {
}
object(PDO)#2 (0) {
}
 [2014-01-01 12:51 UTC] felipe@php.net
-Package: PDO related +Package: PDO Core
 [2014-05-27 03:50 UTC] laruence@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3a1f79d51d81d3a2b0bd70bdf986fa192c53c56b
Log: Fixed bug #47407
 [2014-05-27 03:50 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2014-05-27 06:29 UTC] mike@php.net
-Status: Closed +Status: Assigned -Assigned To: +Assigned To: laruence
 [2014-05-27 06:29 UTC] mike@php.net
It's fixed "only" in phpng, so let's keep it open until/when phpng gets merged.
 [2014-08-15 05:02 UTC] dmitry@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3a1f79d51d81d3a2b0bd70bdf986fa192c53c56b
Log: Fixed bug #47407
 [2014-08-15 05:02 UTC] dmitry@php.net
-Status: Assigned +Status: Closed
 [2016-07-20 11:40 UTC] davey@php.net
Automatic comment on behalf of laruence
Revision: http://git.php.net/?p=php-src.git;a=commit;h=3a1f79d51d81d3a2b0bd70bdf986fa192c53c56b
Log: Fixed bug #47407
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Oct 31 23:01:28 2024 UTC