summaryrefslogtreecommitdiff
path: root/ext/sqlite3/tests
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2010-12-03 21:05:44 +0000
committerFelipe Pena <felipe@php.net>2010-12-03 21:05:44 +0000
commit689d1d9e4bf69289d1a2446cc32cb53b76e9cf4e (patch)
tree3d39966f93da267859a08915c1ecee9dcd2538e0 /ext/sqlite3/tests
parent686c7fec26c7721bb92b836cc40d1232be497334 (diff)
downloadphp-git-689d1d9e4bf69289d1a2446cc32cb53b76e9cf4e.tar.gz
- Fixed bug #53463 (sqlite3 columnName() segfaults on bad column_number)
Diffstat (limited to 'ext/sqlite3/tests')
-rw-r--r--ext/sqlite3/tests/bug53463.phpt28
1 files changed, 28 insertions, 0 deletions
diff --git a/ext/sqlite3/tests/bug53463.phpt b/ext/sqlite3/tests/bug53463.phpt
new file mode 100644
index 0000000000..c9216e660f
--- /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