PHP 5.4: New `PHPCompatibility.ParameterValues.ChangedObStartEraseFlags` sniff by jrfnl · Pull Request #1027 · PHPCompatibility/PHPCompatibility

Conversation

@jrfnl

From: https://www.php.net/manual/en/function.ob-start.php#refsect1-function.ob-start-changelog

The third parameter of ob_start() changed from a boolean parameter called erase
(which, if set to FALSE, would prevent the output buffer from being deleted until
the script finished executing) to an integer parameter called flags.
Unfortunately, this results in an API compatibility break for code written prior to
PHP 5.4.0 that uses the third parameter.

This sniff addresses that change.

Includes unit tests.

@jrfnl jrfnl changed the title New PHPCompatibility.ParameterValues.ChangedObStartEraseFlags sniff PHP 5.4: New PHPCompatibility.ParameterValues.ChangedObStartEraseFlags sniff

May 2, 2020
…lags` sniff

From: https://www.php.net/manual/en/function.ob-start.php#refsect1-function.ob-start-changelog

> The third parameter of ob_start() changed from a boolean parameter called erase
> (which, if set to FALSE, would prevent the output buffer from being deleted until
> the script finished executing) to an integer parameter called flags.
> Unfortunately, this results in an API compatibility break for code written prior to
> PHP 5.4.0 that uses the third parameter.

This sniff addresses that change.

Includes unit tests.

wimg

wimg approved these changes May 20, 2020

ob_start($output_callback, $chunk_size, true);
ob_start($output_callback, $chunk_size, false);

// Not OK - error PHP >= 5.4.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this be < 5.4 since this should be an issue when used on PHP < 5.4 ? And the inverse above ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you're right. I've put the fix in a WIP "minor doc fixes" branch which I'll pull before the release.

@wimg wimg deleted the php-5.4/new-obstart-third-param-sniff branch

May 20, 2020 15:12

Labels

2 participants

@jrfnl @wimg