ob_implicit_flush: Changed "flag" Argument to Boolean
As of PHP 8.0.0, the flag
integer argument of the ob_implicit_flush()
function changed to a boolean. This only causes an issue with strict_types
enabled, although it's best to fix this regardless, to avoid unexpected compatibility issues in the future. Using an integer with strict_types
enabled will throw a TypeError
:
declare(strict_types=1);
ob_implicit_flush(1);
See execution result.
Solution
Replace the argument with a boolean, or cast it:
declare(strict_types=1);
ob_implicit_flush((bool) 1);
Errors or Warnings
- ob_implicit_flush(): Argument #1 ($enable) must be of type bool, int given