From: Felipe Pena Date: Fri, 13 Feb 2009 02:20:52 +0000 (+0000) Subject: - New test X-Git-Tag: RELEASE_1_3_5~140 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=7c34d6f76ba1c1737c14b6e8c4bdd503b8695ed3;p=php - New test --- diff --git a/ext/pdo_sqlite/tests/bug43831.phpt b/ext/pdo_sqlite/tests/bug43831.phpt new file mode 100644 index 0000000000..1132e9b76f --- /dev/null +++ b/ext/pdo_sqlite/tests/bug43831.phpt @@ -0,0 +1,51 @@ +--TEST-- +Bug #43831 ($this gets mangled when extending PDO with persistent connection) +--FILE-- + 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(); + + +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); +unset($bar); +var_dump($baz); +var_dump($bar); + + +?> +--EXPECTF-- +Bar +Bar +object(MyPDO)#%d (0) { +} +object(MyPDO)#%d (0) { +} + +Notice: Undefined variable: bar in %s on line %d +NULL