php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #70596 No description of warning for min(array())
Submitted: 2015-09-28 08:56 UTC Modified: 2015-12-18 20:39 UTC
From: lennaertvanderlinden at gmail dot com Assigned: tpunt (profile)
Status: Closed Package: Documentation problem
PHP Version: 5.6.13 OS:
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: lennaertvanderlinden at gmail dot com
New email:
PHP Version: OS:

 

 [2015-09-28 08:56 UTC] lennaertvanderlinden at gmail dot com
Description:
------------
I am using PHP 5.6.4-4ubuntu6.2

The documentation does not describe the behaviour when an empty array is passed in or no arguments at all.

I get a warning in PHP 5.6, but this may be version specific. I would like to see the behaviour described for the min and max functions:
- warnings emitted
- return value

Test script:
---------------
<?php

print min(array()); // returns false, emits a warning in PHP 5.6
print min(); // returns NULL, emits a warning in PHP 5.6


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-12-18 20:36 UTC] tpunt@php.net
Automatic comment from SVN on behalf of tpunt
Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=338308
Log: Resolve doc bug #70596
 [2015-12-18 20:37 UTC] tpunt@php.net
-Assigned To: +Assigned To: tpunt
 [2015-12-18 20:39 UTC] tpunt@php.net
All PHP functions will emit an E_WARNING and return false when a function's required arguments have not been passed in.

As for passing in empty arrays, I've made the following commit to mention this in both the min() and max() functions: https://svn.php.net/viewvc?view=revision&revision=338308
 [2015-12-18 20:39 UTC] tpunt@php.net
-Status: Assigned +Status: Closed
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Jul 16 03:01:33 2025 UTC