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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 12:01:31 2025 UTC