Skip to content

Conversation

@jrfnl
Copy link
Member

@jrfnl jrfnl commented May 1, 2020

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 added this to the 10.0.0 milestone May 1, 2020
@jrfnl jrfnl requested a review from wimg May 1, 2020 19:33
@jrfnl jrfnl force-pushed the php-5.4/new-obstart-third-param-sniff branch from faaf6be to fd5518e Compare May 1, 2020 23:36
@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.
@jrfnl jrfnl force-pushed the php-5.4/new-obstart-third-param-sniff branch from fd5518e to 055b408 Compare May 2, 2020 17:07
ob_start($output_callback, $chunk_size, true);
ob_start($output_callback, $chunk_size, false);

// Not OK - error PHP >= 5.4.
Copy link
Member

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 ?

Copy link
Member Author

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 merged commit 0f4807e into develop May 20, 2020
@wimg wimg deleted the php-5.4/new-obstart-third-param-sniff branch May 20, 2020 15:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants