ID: 43831
Updated by: [EMAIL PROTECTED]
Reported By: mjs at beebo dot org
-Status: Assigned
+Status: Verified
Bug Type: PDO related
Operating System: OS X/Linux
PHP Version: 5.2.5
Assigned To: wez
New Comment:
/home/felipe/dev/php5/ext/pdo/pdo_dbh.c(1516) : Freeing 0x088CEA34 (44
bytes), script=../bug.php
[Fri Oct 24 18:55:13 2008] Script: '../bug.php'
/home/felipe/dev/php5/ext/pdo/pdo_dbh.c(1517) : Freeing 0x088D7844 (32
bytes), script=../bug.php
/home/felipe/dev/php5/Zend/zend_alloc.c(2391) : Actual location
(location was relayed)
=== Total 2 memory leaks detected ===
Previous Comments:
------------------------------------------------------------------------
[2008-01-13 20:55:43] mjs at beebo dot org
Description:
------------
The class of $this changes after the instantiation of a class which
extends PDO, and which specifies PDO::ATTR_PERSISTENT attribute.
Reproduce code:
---------------
class Foo extends PDO {
function __construct($dsn) {
parent::__construct($dsn, null, null,
array(PDO::ATTR_PERSISTENT =>
true));
}
}
class Baz extends PDO {
function __construct($dsn) {
parent::__construct($dsn, null, null,
array(PDO::ATTR_PERSISTENT =>
true));
}
}
class Bar extends Baz {
function quux() {
echo get_class($this), "\n";
$foo = new Foo("sqlite::memory:");
echo get_class($this), "\n";
}
}
$bar = new Bar("sqlite::memory:");
$bar->quux();
Expected result:
----------------
Bar
Bar
i.e. get_class($this) returns the same value each time
Actual result:
--------------
Bar
Foo
i.e. $this gets mangled
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43831&edit=1