PHP 5.4: New `PHPCompatibility.ParameterValues.ChangedObStartEraseFlags` sniff by jrfnl · Pull Request #1027 · PHPCompatibility/PHPCompatibility
Conversation
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
changed the title
New
PHP 5.4: New PHPCompatibility.ParameterValues.ChangedObStartEraseFlags sniffPHPCompatibility.ParameterValues.ChangedObStartEraseFlags sniff
…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 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
deleted the
php-5.4/new-obstart-third-param-sniff
branch
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters