PostgreSQL driver handles boolean values incorrectly...

From: Date: Sun, 07 Nov 2004 01:20:20 +0000
Subject: PostgreSQL driver handles boolean values incorrectly...
Groups: php.internals 
Request: Send a blank email to internals+get-13759@lists.php.net to get a copy of this message
Howdy. Was doing some development with PHP and PostgreSQL and came across a rather nasty surprise. A boolean value is returned as the strings 't' and 'f', not the constants true and false. This presents all kinds of interesting oddities for code that does something like: $r = pg_query("SELECT FALSE"); list($b) = pg_fetch_row($r); if ($b) echo "This gets displayed 100% of the time because %b is the string 'f'\n"; else echo "This never gets displayed: $b is always true\n"; The same problem lies with the NULL value, which IMHO, should be mapped to the constant NULL, not the string 'NULL'. I took a first stab at handling this, but have been by and large unsuccessful, so I'm posting here instead of submitting a complete solution. My patches can be found at the URL below: http://people.FreeBSD.org/~seanc/patches/php/ Any help/assistance is appreciated. I thought I was doing the right thing, but am apparently not. Please advise. Thanks in advance. -sc -- Sean Chittenden

« previous php.internals (#13759) next »