|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #29213 incorrect interpretation of Postgre boolean variables
Submitted: 2004-07-16 16:12 UTC Modified: 2004-08-02 11:17 UTC
From: ataols at latnet dot lv Assigned:
Status: Not a bug Package: PostgreSQL related
PHP Version: 4.3.7 OS: Gentoo Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: ataols at latnet dot lv
New email:
PHP Version: OS:


 [2004-07-16 16:12 UTC] ataols at latnet dot lv
The PHP functions pg_fetch_... incorrectly interprets boolean variables from PostgreSQL databases: instead of setting a boolean PHP variable they set one-character PHP strings with values "f" or "t". Both of them are interpreted as TRUE by PHP.

Reproduce code:
echo $dbvars['boolvar'].",  is_bool: ".is_bool($dbvars['boolvar']).",  is_string: ".is_string($dbvars['boolvar'])."<BR>\n";

Expected result:
, is_bool: 1, is_string: 

Actual result:
f, is_bool: , is_string: 1


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2004-07-18 18:48 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

All data is fetched in the form of strings. 
 [2004-07-18 19:08 UTC] ataols at latnet dot lv
> All data is fetched in the form of strings.
 [2004-07-24 23:08 UTC] ataols at latnet dot lv
Please give me an answer, why "all data is fetched in the form of strings"? For me it makes impossible to use boolean fields under PostgreSQL/PHP, because I can not automatically convert all 'f' strings to false because of possibility that a user inputed varchar date also contains 'f'. And, of course, I can not use boolean values that both are true! So, I switched to integers and 0 or 1 works fine, but it is stupid, that the database system has boolean variables of a smaller size, but I should use integers for boolean values!
 [2004-08-02 11:17 UTC]
Because it's a feature and REQUIRED for very large numbers to maintain precision.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 21 08:01:31 2024 UTC