PEAR is archived and read-only

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

Home » Database » MDB2_Driver_pgsql » Bug #7791

Calling getTableFieldDefinition with erroneus fieldname

Details

Submitted2006-06-02 08:39 UTC
Frommarcus dot kempe at gmail dot com
Assignedlsmith
StatusClosed
PackageMDB2_Driver_pgsql
PHP Version5.0.4
OSFedora 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