Skip to content

null isn't being accepted as first argument to ob_start for PHP 8.0 to 8.3 #12282

@mind-bending-forks

Description

@mind-bending-forks

The PHP docs says that ob_start accepts null or a callback as the first argument:

https://www.php.net/manual/en/function.ob-start.php

There is no indication from the documentation that this has ever changed.

The second example in the docs is one where null is used as the first argument. PHPStan generates an error for this example for PHP 8.0 to 8.3:

https://phpstan.org/r/64e73e65-39da-4a2e-b532-d83e281acd51

I believe that the error for PHP 8.0 to 8.3 is erroneous. php does accept null as the first argument to ob_start without error, even for PHP 8.0 to 8.3.

Unless I missed something when looking in https://github.com/phpstan/phpstan-src/tree/2.0.x/resources, it looks like the signature for ob_start is defined correctly in functionMap.php, and that it is not redefined in any of the delta files. I could be wrong, but I think that this means that the signature should be applied consistently by PHPStan across the different versions, but that's not happening here.

Is it the case that the function signature defined in PHPStan is correct, but that there is some other issue/glitch in PHPStan that is causing this error to be reported for PHP 8.0 to 8.3?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions