Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable22] Correctly skip suppressed errors in PHP 8.0 #27938

Merged
merged 1 commit into from
Jul 14, 2021
Merged

[stable22] Correctly skip suppressed errors in PHP 8.0 #27938

merged 1 commit into from
Jul 14, 2021

Conversation

yan12125
Copy link
Contributor

Manual backport of #27631


Applies the suggested transformation mentioned in
https://www.php.net/manual/en/migration80.incompatible.php,

The @ operator will no longer silence fatal errors (E_ERROR,
E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR,
E_PARSE). Error handlers that expect error_reporting to be 0 when
@ is used, should be adjusted to use a mask check instead

The new code still works on PHP 7, as error_reporting() already
returns 0 when diagnostics are suppressed.

This fixes #25807 in PHP 8.0.
For PHP 7.x, #22243 suppresses
the E_NOTICE message from the second session_start() call with the error
suppression operator @, and thus those E_NOTICE messages are still
logged in PHP 8.0.

See also #25806

Signed-off-by: Chih-Hsuan Yen yan12125@gmail.com

@yan12125 yan12125 changed the title Correctly skip suppressed errors in PHP 8.0 [stable22] Correctly skip suppressed errors in PHP 8.0 Jul 13, 2021
@juliushaertl juliushaertl added 3. to review Waiting for reviews bug labels Jul 13, 2021
@juliushaertl juliushaertl added this to the Nextcloud 22.0.1 milestone Jul 13, 2021
@yan12125
Copy link
Contributor Author

Hmm, integration tests on branch stable22 seem broken after #27654

@juliushaertl
Copy link
Member

Revert of #27654 merged, so a rebase should fix ;)

Applies the suggested transformation mentioned in
https://www.php.net/manual/en/migration80.incompatible.php,

> The @ operator will no longer silence fatal errors (E_ERROR,
> E_CORE_ERROR, E_COMPILE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR,
> E_PARSE). Error handlers that expect error_reporting to be 0 when
> @ is used, should be adjusted to use a mask check instead

The new code still works on PHP 7, as error_reporting() already
returns 0 when diagnostics are suppressed.

This fixes #25807 in PHP 8.0.
For PHP 7.x, #22243 suppresses
the E_NOTICE message from the second session_start() call with the error
suppression operator @, and thus those E_NOTICE messages are still
logged in PHP 8.0.

See also #25806

Signed-off-by: Chih-Hsuan Yen <yan12125@gmail.com>
@yan12125
Copy link
Contributor Author

Thanks, it is green now :)

@blizzz blizzz merged commit f16a806 into nextcloud:stable22 Jul 14, 2021
@yan12125 yan12125 deleted the backport/27631/stable22 branch July 14, 2021 11:30
@skjnldsv skjnldsv mentioned this pull request Jul 26, 2021
@skjnldsv skjnldsv mentioned this pull request Aug 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants