Home » Database » DB » Bug #606
pgsql tableInfo has a bug that free's the result set
Details
| Submitted | 2004-01-21 20:48 UTC |
|---|---|
| From | tyardley at dmisi dot com |
| Assigned | danielc |
| Status | Bogus |
| Package | DB |
| PHP Version | Irrelevant |
| OS | Irrelevant |
| Roadmaps | (Not assigned) |
Comments
[2004-01-21 20:48 UTC] tyardley at dmisi dot com
Description:
------------
When a result set is used instead of a table name, the result set is
free'd even when it is not supposed to be. This problem seems to
only exist in the DB/pgsql.php code.
offending code:
// free the result only if we were called on a table
if (is_string($result) && is_resource($id)) {
@pg_freeresult($id);
}
should be changed to:
// free the result only if we were called on a table
if (is_string($result)) {
@pg_freeresult($id);
}
This goes back as far as I can remember.. and existed all the way
back to 1.2 I believe.
Tim Yardley
Reproduce code:
---------------
None needed. Just look at the source for the function.
if you must duplicate it do a query and then...
$result->tableInfo();
$result->free();
the free will fail.
Expected result:
----------------
the free should suceed and free the result (not having the function
do it itself).
Actual result:
--------------
the free obviously fails since tableInfo() free's it when it isn't
supposed to.