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

1.1       misho       1: --TEST--
                      2: Bug #48773 (Incorrect error when setting PDO::ATTR_STATEMENT_CLASS with ctor_args)
                      3: --SKIPIF--
                      4: <?php
                      5: if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: 
                     10: class bar extends PDOStatement {
                     11:        private function __construct() {
                     12:        }
                     13: }
                     14: 
                     15: class foo extends PDO {
                     16:        public $statementClass = 'bar';
                     17:        function __construct($dsn, $username, $password, $driver_options = array()) {
                     18:                $driver_options[PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
                     19:                parent::__construct($dsn, $username, $password, $driver_options);
                     20: 
                     21:                $this->setAttribute(PDO::ATTR_STATEMENT_CLASS, array($this->statementClass, array($this)));
                     22:        }
                     23: }
                     24: 
                     25: $db = new foo('sqlite::memory:', '', '');
                     26: $stmt = $db->query('SELECT 1');
                     27: var_dump($stmt);
                     28: 
                     29: ?>
                     30: --EXPECTF--
                     31: object(bar)#%d (1) {
                     32:   [%u|b%"queryString"]=>
                     33:   %unicode|string%(8) "SELECT 1"
                     34: }

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