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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to