#31238 [Ana]: pg_field_is_null fails for column with upper case name
| From: | iliaa@php.net | Date: | Wed, 22 Dec 2004 17:32:22 +0000 |
| Subject: | #31238 [Ana]: pg_field_is_null fails for column with upper case name | ||
| References: | 1 | Groups: | php.doc |
| Request: | Send a blank email to phpdoc+get-969365571@lists.php.net to get a copy of this message | ||
ID: 31238
Updated by: iliaa@php.net
Reported By: phpdevel-no-spam at pv2c dot sk
Status: Analyzed
-Bug Type: PostgreSQL related
+Bug Type: Documentation problem
Operating System: *
PHP Version: 4CVS, 5CVS (2004-12-22)
Assigned To: sniper
New Comment:
This should be documented.
Previous Comments:
------------------------------------------------------------------------
[2004-12-22 09:06:10] sniper@php.net
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.
------------------------------------------------------------------------
[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