Annotation of embedaddon/php/ext/pdo_sqlite/tests/bug46139.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--
                      2: Bug #46139 (PDOStatement->setFetchMode() forgets FETCH_PROPS_LATE)
                      3: --SKIPIF--
                      4: <?php
                      5: if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: 
                     10: require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
                     11: $db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
                     12: 
                     13: class Person {
                     14:     public $test = NULL;
                     15:     public function __construct() {
                     16:         var_dump($this->test);
                     17:     }
                     18: }
                     19: 
                     20: $stmt = $db->query("SELECT 'foo' test, 1");
                     21: $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person');
                     22: $r1 = $stmt->fetch();
                     23: printf("'%s'\n", $r1->test);
                     24: 
                     25: $stmt = $db->query("SELECT 'foo' test, 1");
                     26: $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person');
                     27: $r1 = $stmt->fetchAll();
                     28: printf("'%s'\n", $r1[0]->test);
                     29: 
                     30: $stmt = $db->query("SELECT 'foo' test, 1");
                     31: $stmt->setFetchMode(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE, 'Person');
                     32: $r1 = $stmt->fetch(PDO::FETCH_CLASS | PDO::FETCH_PROPS_LATE);
                     33: printf("'%s'\n", $r1->test);
                     34: 
                     35: ?>
                     36: --EXPECT--
                     37: NULL
                     38: 'foo'
                     39: NULL
                     40: 'foo'
                     41: NULL
                     42: 'foo'

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