ob_start: Changed "erase" Argument to Integer "flags"
As of PHP 5.4.0, the erase boolean argument of the ob_start() function changed to a flags integer. Using a boolean with strict_types enabled will throw a TypeError. Without strict_types, the flag will evaluate to the wrong integer, thus causing incorrect behavior. Example:
declare(strict_types=1);
ob_start(null, 0, false);
Solution
declare(strict_types=1);
ob_start(null, 0, PHP_OUTPUT_HANDLER_STDFLAGS ^ PHP_OUTPUT_HANDLER_REMOVABLE);
Errors or Warnings
- ob_start(): Argument #3 ($flags) must be of type int, bool given
- ob_start() expects parameter 3 to be int, bool given
- ob_start() expects parameter 3 to be integer, boolean given