Description:
------------
When using the MDB2 Container with Auth, if the 'db_fields' option is not filled in with at least '*', a call to $auth->userList() returns a PEAR_Error with the error 'syntax error' from the database. On further inspection, the query generated in userList comes out to be "SELECT FROM <tablename>", where <tablename> is the name of the Auth table in the database. The basic problem seems to be that either the default value for db_fields is not set to '*', or no logic is put in place to detect a NULL db_fields option.
Test script:
---------------
<?php
require_once 'Auth.php';
$dsn = 'pgsql://username:password@host/db';
$params = array("dsn" => $dsn,
"table" => 'users',
"usernamecol" => 'username',
"passwordcol" => 'password'
);
$auth = new Auth('MDB2', $params);
if (!is_a($auth, 'Auth')) {
print "no auth";
exit;
}
$test = $auth->listUsers();
if (PEAR::isError($test)) {
echo $test->getMessage();
exit;
}
print_r($test);
?>
Expected result:
----------------
The above script *should* return a list of users from the database, echo'd to the display with the print_r() function.
Actual result:
--------------
The following is output:
MDB2 Error: syntax error

Comments

[2006-08-10 01:30 UTC] aashley at php dot net
(Adam Ashley)

This bug has been fixed in CVS.
If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET).
If this was a problem with the pear.php.net website, the change should be live shortly.
Otherwise, the fix will appear in the package's next release.
Thank you for the report and for helping us make PEAR better.
MDB2 container now uses the same behaviour as the DB container and will always at the very lease return the usernamecol and passwordcol fields.