php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36232 min() with first boolean param
Submitted: 2006-01-31 17:27 UTC Modified: 2006-01-31 18:26 UTC
From: na at index20 dot ru Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.1.2 OS: All
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: na at index20 dot ru
New email:
PHP Version: OS:

 

 [2006-01-31 17:27 UTC] na at index20 dot ru
Description:
------------
min() works abit weird...
Tested on 4.4.1, 5.1.1

Reproduce code:
---------------
var_dump(min(true, 1, -2));
var_dump(min(true, 1, 0, -2));
var_dump(min(true, 1, -2, 0));


Expected result:
----------------
-2
-2
-2

Actual result:
--------------
true
-2
0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-01-31 18:26 UTC] na at index20 dot ru
min(true, 1, 0, -2) == min(min(min(true,1),0),-2) == min(min(true,0),-2) == min(0,-2) == -2;
min(true, 1, -2)    == min(min(true,1), -2) == min(true, -2) == true;
min(true, 1, -2, 0) == min(min(min(true,1),-2),0) == min(min(true, -2), 0) == min(true, 0) == 0;
min(-2, 1, 0, true) == min(min(min(-2,1),0),true) == min(min(-2, 0), true) == min(-2, true) == -2;

just another one weak type gotcha...
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 18 11:01:34 2024 UTC