php.net |  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 Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: ataols at latnet dot lv
New email:
PHP Version: OS:

 

 [2004-07-16 16:12 UTC] ataols at latnet dot lv
Description:
------------
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

Patches

Pull Requests

History

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

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.
 Why?
 [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] derick@php.net
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: Sat Dec 07 14:01:28 2024 UTC