Bug #66350 [NEW]: Custom statement class parameters can cause memory (connection) leak
| From: | sea128 at post dot cz | Date: | Wed, 25 Dec 2013 16:24:27 +0000 |
| Subject: | Bug #66350 [NEW]: Custom statement class parameters can cause memory (connection) leak | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-183463@lists.php.net to get a copy of this message | ||
From: sea128 at post dot cz
Operating system:
PHP version: 5.5.7
Package: PDO related
Bug Type: Bug
Bug description:Custom statement class parameters can cause memory (connection) leak
Description:
------------
Setting statement class with PDO object as parameter causes cyclic
reference which prevent from garbage collection.
Test script:
---------------
// it is not sqlite bug, similar problem is with postgresql
$db = new PDO('sqlite::memory:');
// this line will prevent from garbage collection
$db->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('PDOStatement',
array($db)));
// this line will not close connection
unset($db);
// this line will not close connection too
gc_collect_cycles();
--
Edit bug report at https://bugs.php.net/bug.php?id=66350&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66350&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66350&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66350&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66350&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66350&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66350&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66350&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66350&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66350&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66350&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66350&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66350&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66350&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66350&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66350&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66350&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66350&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66350&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66350&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66350&r=mysqlcfg