summaryrefslogtreecommitdiff
path: root/ext/sqlite3/tests
diff options
context:
space:
mode:
authorOndřej Surý <ondrej@sury.org>2011-02-16 10:13:02 +0100
committerOndřej Surý <ondrej@sury.org>2011-02-16 10:13:02 +0100
commitfd5a0b31640419ca63d1ddeaffd6d3cf2a741814 (patch)
treebfd17d84c5181d7b98d7d66f56573f4fc897e31c /ext/sqlite3/tests
parent01fcdff3849c3691d9aaeaab735846ab6d8895ca (diff)
downloadphp-upstream/5.3.5.tar.gz
Imported Upstream version 5.3.5upstream/5.3.5
Diffstat (limited to 'ext/sqlite3/tests')
-rw-r--r--ext/sqlite3/tests/bug53463.phpt28
-rw-r--r--ext/sqlite3/tests/sqlite3_15_open_error.phpt4
2 files changed, 30 insertions, 2 deletions
diff --git a/ext/sqlite3/tests/bug53463.phpt b/ext/sqlite3/tests/bug53463.phpt
new file mode 100644
index 000000000..c9216e660
--- /dev/null
+++ b/ext/sqlite3/tests/bug53463.phpt
@@ -0,0 +1,28 @@
+--TEST--
+Bug #53463 (sqlite3 columnName() segfaults on bad column_number)
+--FILE--
+<?php
+
+$db = new SQLite3(':memory:');
+
+$db->exec('CREATE TABLE test (whatever INTEGER)');
+$db->exec('INSERT INTO test (whatever) VALUES (1)');
+
+$result = $db->query('SELECT * FROM test');
+while ($row = $result->fetchArray(SQLITE3_NUM)) {
+ var_dump($result->columnName(0)); // string(8) "whatever"
+
+ // Seems returning false will be most appropriate.
+ var_dump($result->columnName(3)); // Segmentation fault
+}
+
+$result->finalize();
+$db->close();
+
+echo "Done\n";
+
+?>
+--EXPECT--
+string(8) "whatever"
+bool(false)
+Done \ No newline at end of file
diff --git a/ext/sqlite3/tests/sqlite3_15_open_error.phpt b/ext/sqlite3/tests/sqlite3_15_open_error.phpt
index 1fcaca9c7..49168fd19 100644
--- a/ext/sqlite3/tests/sqlite3_15_open_error.phpt
+++ b/ext/sqlite3/tests/sqlite3_15_open_error.phpt
@@ -16,8 +16,8 @@ echo "Done\n";
unlink($unreadable);
?>
--EXPECTF--
-exception 'Exception' with message 'Unable to open database: %s' in %s/sqlite3_15_open_error.php:%d
+exception 'Exception' with message 'Unable to open database: %s' in %ssqlite3_15_open_error.php:%d
Stack trace:
-#0 %s/sqlite3_15_open_error.php(%d): SQLite3->__construct('%s')
+#0 %ssqlite3_15_open_error.php(%d): SQLite3->__construct('%s')
#1 {main}
Done