-
-
Notifications
You must be signed in to change notification settings - Fork 946
Description
Issue
PHPStan has started complaining for PHP 8.x when the first argument to ob_start ($callback) is null. See https://phpstan.org/r/1164573f-22b3-41fd-a678-bdd27058615b It reports:
Parameter #1 $callback of function ob_start expects callable(): mixed, null given.
However, the documentation for ob_start on 23 June 2022 has:
- a function signature with the first argument accepting
null, - text that says that "The callback parameter may be bypassed by passing a null value"; and
- an example with
nullas the first argument.
So, unless the documentation is out of date, this looks to be a regression in the ob_start function signature, most likely relating to changes in the way callables are handled in PHP 8.x.
Reproducing
Use the second example from the ob_start documentation, a one-liner:
ob_start(null, 0, PHP_OUTPUT_HANDLER_STDFLAGS ^ PHP_OUTPUT_HANDLER_REMOVABLE);Implemented at https://phpstan.org/r/1164573f-22b3-41fd-a678-bdd27058615b
Expected output: PHPStan should not report any errors.
Other
We're working on PHP 8.x support for our PHP code base. PHPStan is proving to be a valuable tool. Not sure how we managed to get by without it before. Thanks.