ID: 47414
Comment by: cruzader at gmx dot de
Reported By: [email protected]
Status: Open
Bug Type: PDO related
PHP Version: 5.3CVS-2009-02-16 (CVS)
New Comment:
Using: PHP 5.2.9RC2 (cli) (built: Feb 19 2009 16:29:53)
OS: OpenSuse 10.3
Description:
----------------
Any error with PDO will result in a memory leak.
Reproduce code:
----------------
while (1) {
$test = new PDO($db['dsn'], $db['username'], $db['password']);
print "\n".memory_get_usage();
}
Previous Comments:
------------------------------------------------------------------------
[2009-02-16 22:31:07] [email protected]
Description:
------------
See below.
Reproduce code:
---------------
<?php
$db = new PDO('firebird:dbname=...', 'sysdba', 'foo');
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING);
@$db->exec('drop table test');
$db->exec('CREATE TABLE test(idx int NOT NULL PRIMARY KEY, txt
VARCHAR(20))');
$db->exec('INSERT INTO test VALUES(0, \'String0\')');
$stmt = $db->prepare('SELECT idx, txt FROM test ORDER by idx');
$idx = $txt = 0;
$stmt->bindColumn('IDX', $idx);
$stmt->bindColumn('TXT', $txt);
$stmt->execute();
while($stmt->fetch(PDO::FETCH_BOUND)) {
var_dump(array($idx=>$txt));
}
Actual result:
--------------
array(1) {
[0]=>
string(7) "String0"
}
[Mon Feb 16 19:30:09 2009] Script: '../test.php'
/home/felipe/dev/php5/main/spprintf.c(775) : Freeing 0x090E8A64 (79
bytes), script=../test.php
Last leak repeated 1 time
=== Total 2 memory leaks detected ===
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=47414&edit=1