Problem with mysql_fetch_array tests.
| From: | ed slattery | Date: | Fri, 11 Apr 2008 12:09:35 +0000 |
| Subject: | Problem with mysql_fetch_array tests. | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-64172@lists.php.net to get a copy of this message | ||
This group of tests pass parameters to a main function, which pushes the
values into a database and validates the result.
Sometimes the parameters passed are something like:
func_mysql_fetch_array($link, $engine, "TIME", @date('H:i:s'),
@date('H:i:s'), 480);
where the two calls to date give the date to push, and the date to check the
response against.
Since these are separate calls, sometimes you are unlucky enough to pass
over a second between the calls, and get a different date for the comparison
from the original.
The test would be more reliable written as:
$x = @date('H:i:s');
func_mysql_fetch_array($link, $engine, "TIME", $x, $x, 480);