#31238 [Opn->Ana]: pg_field_is_null fails for column with upper case name
ID: 31238
Updated by: sniper@php.net
Reported By: phpdevel-no-spam at pv2c dot sk
-Status: Open
+Status: Analyzed
Bug Type: PostgreSQL related
-Operating System: Linux
+Operating System: *
-PHP Version: 4.3.10
+PHP Version: 4CVS, 5CVS (2004-12-22)
-Assigned To:
+Assigned To: sniper
New Comment:
I can verify this. It happens because the underlying
PQfnumber() function tolower()'s the passed field name.
You can avoid that by passing the name double-quoted:
- if(pg_field_is_null($res, 0, $field))
+ if(pg_field_is_null($res, 0, "\"$field\""))
I have prepared a patch for this but it's up to the "committee" whether
we will fix this in sources or in documentation.
Previous Comments:
------------------------------------------------------------------------
[2004-12-22 01:00:11] phpdevel-no-spam at pv2c dot sk
Description:
------------
When calling pg_field_is_null() with 3. parameter the column name and
it has upper case letters in it, an error is the result:
"PHP Warning: pg_field_is_null(): Bad column offset specified in
bugtest.php on line 15"
This bug was reproduced using PostgreSQL 7.4.6, PHP 4.3.10
PostgreSQL 7.4.6, PHP 4.3.9
PostgreSQL 7.4.6, PHP 4.3.10
using two different servers.
This bug doesn't occur when the 3. parameter is column offset, or the
column name contains only lover case letters.
Reproduce code:
---------------
http://www.pv2c.sk/php/bugtest.zip (1KB)
Included is also a sample db creation script.
Expected result:
----------------
Just want to know if the column is NULL.
Actual result:
--------------
Just an warning.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=31238&edit=1
Thread (2 messages)