diff options
author | Felipe Pena <felipe@php.net> | 2009-02-13 02:20:52 +0000 |
---|---|---|
committer | Felipe Pena <felipe@php.net> | 2009-02-13 02:20:52 +0000 |
commit | 7c34d6f76ba1c1737c14b6e8c4bdd503b8695ed3 (patch) | |
tree | 2b148c86ff4468c0965e2059862570160116f10a /ext/pdo_sqlite | |
parent | f0a96595d08be59c3854662a2ca24424202dc455 (diff) | |
download | php-git-7c34d6f76ba1c1737c14b6e8c4bdd503b8695ed3.tar.gz |
- New test
Diffstat (limited to 'ext/pdo_sqlite')
-rw-r--r-- | ext/pdo_sqlite/tests/bug43831.phpt | 51 |
1 files changed, 51 insertions, 0 deletions
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-- +<?php + +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(); + + +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 |