Re: Bug #12245 Updated: gettype(true && true) returns "integer"!

From: Date: Wed, 08 Aug 2001 23:18:58 +0000
Subject: Re: Bug #12245 Updated: gettype(true && true) returns "integer"!
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-62662@lists.php.net to get a copy of this message
Patch attached ----- Original Message ----- From: <jeroen@php.net> Newsgroups: php.dev To: <php-dev@lists.php.net> Sent: Thursday, August 09, 2001 1:12 AM Subject: Bug #12245 Updated: gettype(true && true) returns "integer"! > ID: 12245 > Updated by: jeroen > Reported By: nick@macaw.demon.co.uk > Old Status: Open > Status: Assigned > Bug Type: Variables related > Operating System: Solaris > PHP Version: 4.0.6 > New Comment: > > KISS example: > > var_dump(TRUE || TRUE) -> int(1) > var_dump(FALSE && FALSE) -> int(0) > > Patch awaiting to be committed, will be fixed in 4.0.7 > > > > Previous Comments: > ------------------------------------------------------------------------ > > [2001-07-19 05:56:38] nick@macaw.demon.co.uk > > The && operator (and ||) returns an integer value even when both arguments are boolean. Thus the following code: > > function is_true($val) > { > return (is_bool($val) && $val); > } > > echo (is_true(true) ? 'T' : 'F'),"\n"; > echo (is_true(is_true(true)) ? 'T' : 'F'),"\n"; > > gives > > T > F > > -- Nick > > > > ------------------------------------------------------------------------ > > > > Edit this bug report at > http://bugs.php.net/?id=12245&edit=1 >

Attachment: [application/octet-stream] fix12245.diff
« previous php.dev (#62662) next »