|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2009-04-18 19:11 UTC] dave at ifox dot com
[2011-01-02 02:13 UTC] jani@php.net
-Summary: string -> boolean conversion of
"\0" could give FALSE
+Summary: string -> boolean conversion of
"\0" should give FALSE
-Package: Feature/Change Request
+Package: Scripting Engine problem
-Operating System:
+Operating System: *
-PHP Version: 5.2.0
+PHP Version: *
[2014-10-12 14:30 UTC] nikic@php.net
-Status: Open
+Status: Wont fix
[2014-10-12 14:30 UTC] nikic@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 21:00:01 2025 UTC |
Description: ------------ It might be useful that (boolean)"\0" would give FALSE. E.g. MySQL's BIT(1) column type can be used to store boolean values, but now PHP converts whatever value to TRUE. Reproduce code: --------------- header('Content-Type: text/plain'); echo "\nfalse: ".ord(false); echo "\ntrue: ".ord(true); echo "\n\\0: ".(boolean)("\0"); echo "\n\\1: ".(boolean)("\1"); // ord() is here just for thoughts context... Expected result: ---------------- false: 0 true: 49 \0: 0 \1: 1 Actual result: -------------- false: 0 true: 49 \0: 1 <----- HERE \1: 1