Skip to content

min([]) and max([]) throws ValueError as of 8.0 #2016

Open
@cmarangon

Description

@cmarangon

https://github.com/php/doc-en/blob/master/reference/math/functions/min.xml#L83

From PHP 8.0, calling min() with an empty array as argument will throw a ValueError.
Current doc does not mention this.

Fatal error: Uncaught ValueError: min(): Argument #1 ($value) must contain at least one element in [...]

Activity

cmb69

cmb69 commented on Nov 16, 2022

@cmb69
Member

Indeed. max() has the same problem; and we should probably clarify, that "calling min() with an empty array as argument" refers to the second signature (see https://3v4l.org/Ic2BQ).

added
bugDocumentation contains incorrect information
on Nov 16, 2022
changed the title [-]min([]) throws ValueError in php8.0[/-] [+]min([]) and max([]) throws ValueError as of 8.0[/+] on Jul 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Extension: standardbugDocumentation contains incorrect information

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @cmb69@cmarangon@Girgias

        Issue actions

          min([]) and max([]) throws ValueError as of 8.0 · Issue #2016 · php/doc-en