Unit test for query_parameters(), fix bugs in query_parameters() found by the unit test

This commit is contained in:
Chris Morgan
2006-06-27 16:39:40 +00:00
committed by WineHQ
parent 1932248293
commit f3c64ff48f
5 changed files with 145 additions and 6 deletions

View File

@@ -50,10 +50,14 @@ function query_parameters()
$data = func_get_args();
$query = $data[0];
$tokens = split("[\&\?\~]", $query);
$tokens = split("[&?~]", $query); /* NOTE: no need to escape characters inside of [] in regex */
$preparedquery = $tokens[0];
$count = strlen($tokens[0]);
/* do we have the correct number of tokens to the number of parameters provided? */
if(count($tokens) != count($data))
return NULL; /* count mismatch, return NULL */
for ($i=1; $i < count($tokens); $i++)
{
$char = substr($query, $count, 1);