ID: 43831
Updated by: [EMAIL PROTECTED]
Reported By: mjs at beebo dot org
-Status: Open
+Status: Assigned
Bug Type: PDO related
Operating System: OS X/Linux
PHP Version: 5.2.5
-Assigned To:
+Assigned To: wez
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