Home » Database » MDB2_Driver_pgsql » Bug #7791
Calling getTableFieldDefinition with erroneus fieldname
Details
| Submitted | 2006-06-02 08:39 UTC |
|---|---|
| From | marcus dot kempe at gmail dot com |
| Assigned | lsmith |
| Status | Closed |
| Package | MDB2_Driver_pgsql |
| PHP Version | 5.0.4 |
| OS | Fedora Core 4 |
| Roadmaps | (Not assigned) |
Comments
[2006-06-02 08:39 UTC] marcus dot kempe at gmail dot com
Description:
------------
If I call getTableFieldDefinition($tablename,$fieldsname), everything works as expected (if both $tablename and $fieldname exist in my DB.)
But if I call it with a fieldname that doesn't exist, it returns an error such as:
Warning: array_change_key_case() [function.array-change-key-case]: The argument should be an array in /usr/share/pear/MDB2/Driver/Reverse/pgsql.php on line 97
Fatal error: Cannot use object of type MDB2_Error as array in /usr/share/pear/MDB2/Driver/Reverse/pgsql.php on line 98
I figure it might be nicer if it would return an empty result-set.
I solved it by changing line 95
from:
if (MDB2::isError($column)) {
to:
if (MDB2::isError($column) || is_null($column)) {
I figure this might not be the right solution and you might very well not even consider this a bug. Just wanted to point out my problem.
Best regards!
/Marcus