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

1.1       misho       1: --TEST--
                      2: Bug #66033 (Segmentation Fault when constructor of PDO statement throws an exception)
                      3: --SKIPIF--
                      4: <?php
                      5: if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
                      6: ?>
                      7: --FILE--
                      8: <?php
                      9: class DBStatement extends PDOStatement {
                     10:        public $dbh;
                     11:        protected function __construct($dbh) {
                     12:                $this->dbh = $dbh;
                     13:                throw new Exception("Blah");
                     14:        }
                     15: }
                     16: 
                     17: $pdo = new PDO('sqlite::memory:', null, null);
                     18: $pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('DBStatement',
                     19:        array($pdo)));
                     20: $pdo->exec("CREATE TABLE IF NOT EXISTS messages (
                     21:        id INTEGER PRIMARY KEY,
                     22:        title TEXT,
                     23:        message TEXT,
                     24:        time INTEGER)");
                     25: 
                     26: try {
                     27:        $pdoStatement = $pdo->query("select * from messages");
                     28: } catch (Exception $e) {
                     29:        var_dump($e->getMessage());
                     30: }
                     31: ?>
                     32: --EXPECTF--
                     33: string(4) "Blah"

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