summaryrefslogtreecommitdiff
path: root/ext/sqlite/tests
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2009-10-12 19:04:00 +0000
committerFelipe Pena <felipe@php.net>2009-10-12 19:04:00 +0000
commit16be0343d701a52c451d13657d1503a04811b3b5 (patch)
tree892b5feccb1fb1e500baf5962eed0e537bdd31e6 /ext/sqlite/tests
parentb394a75ad56377504974770cff89c54fbad8a97e (diff)
downloadphp-git-16be0343d701a52c451d13657d1503a04811b3b5.tar.gz
- Fixed possible crash when calling SQLiteDatabase::{ArrayQuery, SingleQuery} methods using Reflection
Diffstat (limited to 'ext/sqlite/tests')
-rw-r--r--ext/sqlite/tests/sqlitedatabase_arrayquery.phpt23
1 files changed, 23 insertions, 0 deletions
diff --git a/ext/sqlite/tests/sqlitedatabase_arrayquery.phpt b/ext/sqlite/tests/sqlitedatabase_arrayquery.phpt
new file mode 100644
index 0000000000..1e3084cebe
--- /dev/null
+++ b/ext/sqlite/tests/sqlitedatabase_arrayquery.phpt
@@ -0,0 +1,23 @@
+--TEST--
+Testing SQLiteDatabase::ArrayQuery with NULL-byte string
+--SKIPIF--
+<?php
+if (!extension_loaded("sqlite")) print "skip";
+?>
+--FILE--
+<?php
+
+$method = new ReflectionMethod('sqlitedatabase::arrayquery');
+
+$class = $method->getDeclaringClass()->newInstanceArgs(array(':memory:'));
+
+$p = "\0";
+
+$method->invokeArgs($class, array_fill(0, 2, $p));
+$method->invokeArgs($class, array_fill(0, 1, $p));
+
+?>
+--EXPECTF--
+Warning: SQLiteDatabase::arrayQuery() expects parameter 2 to be long, string given in %s on line %d
+
+Warning: SQLiteDatabase::arrayQuery(): Cannot execute empty query. in %s on line %d