#29213 [Bgs->Opn]: incorrect interpretation of Postgre boolean variables
ID: 29213
User updated by: ataols at latnet dot lv
Reported By: ataols at latnet dot lv
-Status: Bogus
+Status: Open
Bug Type: PostgreSQL related
Operating System: Gentoo Linux
PHP Version: 4.3.7
New Comment:
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!
Previous Comments:
------------------------------------------------------------------------
[2004-07-18 19:08:49] ataols at latnet dot lv
> All data is fetched in the form of strings.
Why?
------------------------------------------------------------------------
[2004-07-18 18:48:38] 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-16 16:12:06] 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
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29213&edit=1
Thread (5 messages)