PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #3153

an if return always true because PHP5

Details

Submitted2005-01-10 18:55 UTC
Fromsylvain at rugama dot com
Assigneddanielc
StatusDuplicate
PackageDB
PHP Version5.0.3
OSWinXP
Roadmaps(Not assigned)

Comments

[2005-01-10 18:55 UTC] sylvain at rugama dot com

Description:
------------
the problem come from the pgsql.php file
I don't know why exactely, but it seem to be a PHP5 Engine bug or different code execution between PHP4 and PHP5.

pgsql.php, line 724 :

if (isset($result->result)) {
/*
* Probably received a result object.
* Extract the result resource identifier.
*/
$id = $result->result;
$got_string = false;
} elseif (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;
} else { ...

i changed to

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 { ...

the var $result is a string, but isset($result->result) return (always?) true
so i just inverse the condition and it's ok now