Annotation of embedaddon/php/ext/pdo_sqlite/tests/bug43831.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #43831 ($this gets mangled when extending PDO with persistent connection)
        !             3: --SKIPIF--
        !             4: <?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
        !             5: --FILE--
        !             6: <?php
        !             7: 
        !             8: class Foo extends PDO {
        !             9:        function __construct($dsn) {
        !            10:                parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT => true));
        !            11:        }
        !            12: }
        !            13: 
        !            14: class Baz extends PDO {
        !            15:        function __construct($dsn) {
        !            16:                parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT => true));
        !            17:        }
        !            18: }
        !            19: 
        !            20: class Bar extends Baz {
        !            21:        function quux() {
        !            22:                echo get_class($this), "\n";
        !            23:                $foo = new Foo("sqlite::memory:");
        !            24:                echo get_class($this), "\n";
        !            25:        }
        !            26: }
        !            27: 
        !            28: $bar = new Bar("sqlite::memory:");
        !            29: $bar->quux();
        !            30: 
        !            31: 
        !            32: class MyPDO extends PDO {}
        !            33: 
        !            34: $bar = new PDO("sqlite::memory:", null, null, array(PDO::ATTR_PERSISTENT => true));
        !            35: $baz = new MyPDO("sqlite::memory:", null, null, array(PDO::ATTR_PERSISTENT => true));
        !            36: 
        !            37: var_dump($bar);
        !            38: unset($bar);
        !            39: var_dump($baz);
        !            40: var_dump($bar);
        !            41: 
        !            42: 
        !            43: ?>
        !            44: --EXPECTF--
        !            45: Bar
        !            46: Bar
        !            47: object(MyPDO)#%d (0) {
        !            48: }
        !            49: object(MyPDO)#%d (0) {
        !            50: }
        !            51: 
        !            52: Notice: Undefined variable: bar in %s on line %d
        !            53: NULL

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>