summaryrefslogtreecommitdiff
path: root/ext/pdo_sqlite/tests
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2013-11-21 09:50:14 +0100
committerOndřej Surý <ondrej@sury.org>2013-11-21 09:50:14 +0100
commit0d7d3241164b4769b93867da2e8adb724ae17950 (patch)
tree18848ffcc5f7d70c56cd890352f518b60af11ea1 /ext/pdo_sqlite/tests
parent3f2474550cbf299d8a7df34988ece052a0401414 (diff)
downloadphp-0d7d3241164b4769b93867da2e8adb724ae17950.tar.gz
New upstream version 5.5.6+dfsgupstream/5.5.6+dfsg
Diffstat (limited to 'ext/pdo_sqlite/tests')
-rw-r--r--ext/pdo_sqlite/tests/bug66033.phpt33
1 files changed, 33 insertions, 0 deletions
diff --git a/ext/pdo_sqlite/tests/bug66033.phpt b/ext/pdo_sqlite/tests/bug66033.phpt
new file mode 100644
index 000000000..28da3b54b
--- /dev/null
+++ b/ext/pdo_sqlite/tests/bug66033.phpt
@@ -0,0 +1,33 @@
+--TEST--
+Bug #66033 (Segmentation Fault when constructor of PDO statement throws an exception)
+--SKIPIF--
+<?php
+if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
+?>
+--FILE--
+<?php
+class DBStatement extends PDOStatement {
+ public $dbh;
+ protected function __construct($dbh) {
+ $this->dbh = $dbh;
+ throw new Exception("Blah");
+ }
+}
+
+$pdo = new PDO('sqlite::memory:', null, null);
+$pdo->setAttribute(PDO::ATTR_STATEMENT_CLASS, array('DBStatement',
+ array($pdo)));
+$pdo->exec("CREATE TABLE IF NOT EXISTS messages (
+ id INTEGER PRIMARY KEY,
+ title TEXT,
+ message TEXT,
+ time INTEGER)");
+
+try {
+ $pdoStatement = $pdo->query("select * from messages");
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+?>
+--EXPECTF--
+string(4) "Blah"