Home » Authentication » Auth » Bug #9726
Can't login with Postgresql and no public schema
Details
| Submitted | 2007-01-03 18:50 UTC |
|---|---|
| From | edmar at sc dot usp dot br |
| Status | Bogus |
| Package | Auth |
| PHP Version | 5.1.2 |
| OS | Ubuntu 6.10 Server |
| Roadmaps | (Not assigned) |
Comments
[2007-01-03 18:50 UTC] edmar at sc dot usp dot br
Description:
------------
I try to login with my database in postgresql 8.1, but I get a error. The error is in the query syntaxe sending to Postgresql. My users is in a "seguranca" database on a "admin" schema, not in the "public" schema. My final query sent to a database is SELECT "usuario", "senha" FROM "admin.usuario" WHERE "usuario" = 'teste'. The Postgresql return a error: ERRO: relação "admin.usuario" não existe. The query SELECT "usuario", "senha" FROM admin.usuario WHERE "usuario" = 'teste', works correctly.
Test script:
---------------
<?php
require_once "Auth.php";
function loginFunction($username=null, $status=null, &$auth=null) {
echo "<form method=\"post\" action=\"test.php\">";
echo "<input type=\"text\" name=\"username\">";
echo "<input type=\"password\" name=\"password\">";
echo "<input type=\"submit\">"; echo "</form>";
}
$options = array(
"dsn" => "pgsql://seguranca:seg1019@localhost/seguranca",
"table" => "admin.usuario",
"usernamecol" => "usuario",
"passwordcol" => "senha"
);
$a = new Auth("DB", $options, "loginFunction");
$a->start();
if ($a->checkAuth()) echo 'Login OK';
?>
Expected result:
----------------
Login OK
[2007-01-03 19:09 UTC] edmar at sc dot usp dot br
The problem is in Auth_Container_DB.
Auth/Container/DB.php, _prepare function, line 155
As a temporary solution, I change my code in Auth_Container_DB pear class from:
$this->options['final_table'] = $this->db->quoteIdentifier( $this->options['table']);
to
$this->options['final_table'] = $this->options['table'];
[2007-01-03 22:38 UTC] aashley at php dot net
Thank you for taking the time to write to us, but this is not
a bug.
This behaviour is detailed in the release notes for the last several versions and the documentation for the DB container.
Add 'auto_quote' => false, to the options array passed to Auth_Container_DB
[2007-01-31 17:51 UTC] edmar at sc dot usp dot br
Tank's for your help.