summaryrefslogtreecommitdiff
path: root/ext/sqlite3/tests/bug53463.phpt
diff options
context:
space:
mode:
Diffstat (limited to 'ext/sqlite3/tests/bug53463.phpt')
-rw-r--r--ext/sqlite3/tests/bug53463.phpt30
1 files changed, 30 insertions, 0 deletions
diff --git a/ext/sqlite3/tests/bug53463.phpt b/ext/sqlite3/tests/bug53463.phpt
new file mode 100644
index 0000000..744a214
--- /dev/null
+++ b/ext/sqlite3/tests/bug53463.phpt
@@ -0,0 +1,30 @@
+--TEST--
+Bug #53463 (sqlite3 columnName() segfaults on bad column_number)
+--SKIPIF--
+<?php require_once(dirname(__FILE__) . '/skipif.inc'); ?>
+--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