Re: DB getTables() and permissions, bug #5800
| From: | Leo Lutz | Date: | Fri, 28 Oct 2005 16:04:55 +0000 |
| Subject: | Re: DB getTables() and permissions, bug #5800 | ||
| References: | 1 2 3 4 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-40330@lists.php.net to get a copy of this message | ||
Hey Daniel,
On 10/28/05, Daniel Convissor <danielc@analysisandsolutions.com> wrote:
> Hi Leo:
>
> On Thu, Oct 27, 2005 at 04:24:09PM -0700, Leo Lutz wrote:
> > Gracefully, yes. Knowing what the actual cause of the 'throw' is not
> > currently possible.
>
> How so? When one does DB::tableInfo() on a pgsql table that one doesn't
> have permission on doesn't produce a DB_ERROR_ACCESS_VIOLATION?
>
> --Dan
>
Ahh, I think I figured it out.
DB/pgsql.php->tableInfo doesn't have an error catch when it runs the
sql statement. So the first error catch it hits is a test whether
valid data was passed in. That manually throws a
DB_ERROR_NEED_MORE_DATA which makes sense.
function tableInfo($result, $mode = null)
{
if (is_string($result)) {
/*
* Probably received a table name.
* Create a result resource identifier.
*/
$id = @pg_exec($this->connection, "SELECT * FROM $result LIMIT 0");
$got_string = true;
} elseif (isset($result->result)) {
/*
* Probably received a result object.
* Extract the result resource identifier.
*/
$id = $result->result;
$got_string = false;
} else {
/*
* Probably received a result resource identifier.
* Copy it.
* Deprecated. Here for compatibility only.
*/
$id = $result;
$got_string = false;
}
if (!is_resource($id)) {
return $this->pgsqlRaiseError(DB_ERROR_NEED_MORE_DATA);
}
--Leo