|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12245 gettype(true && true) returns "integer"!
Submitted: 2001-07-19 05:56 UTC Modified: 2001-08-30 08:12 UTC
From: nick at macaw dot demon dot co dot uk Assigned: jeroen (profile)
Status: Closed Package: Variables related
PHP Version: 4.0.6 OS: Solaris
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: nick at macaw dot demon dot co dot uk
New email:
PHP Version: OS:


 [2001-07-19 05:56 UTC] nick at macaw dot demon dot co dot 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";



-- Nick


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-08 19:12 UTC]
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

 [2001-08-19 05:14 UTC]
added missing 'Assign To:' info.

 [2001-08-30 08:12 UTC]
Fixed in 4.0.7
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Aug 02 13:01:24 2021 UTC