Bug #70132 [Com]: bit(1) always seen as true

From: Date: Sat, 25 Jul 2015 21:45:40 +0000
Subject: Bug #70132 [Com]: bit(1) always seen as true
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-194711@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70132&edit=1 ID: 70132 Comment by: fontanalorenz at gmail dot com Reported by: stanimir at datacentrix dot org Summary: bit(1) always seen as true Status: Open Type: Bug Package: PDO MySQL Operating System: linux PHP Version: 5.6.11 Block user comment: N Private report: N New Comment: AFAIK the expected result is true because when 0x00 is converted by chr gives you a one char string so when you cast to bool it returns true; To verify that you can just do <?php $chr = chr(0x00); var_dump((bool)$chr); // bool(true) var_dump(strlen($chr)); // int(1) Previous Comments: ------------------------------------------------------------------------ [2015-07-24 16:56:43] stanimir at datacentrix dot org Description: ------------ Using MySQL 5.5.44, BIT(1) column returns either 0x00 or 0x01, both are considered as true by the language. Test script: --------------- var_dump((bool) chr(0x00)); Expected result: ---------------- boolean false Actual result: -------------- boolean true ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70132&edit=1

« previous php.bugs (#194711) next »