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

[stable21] Correctly skip suppressed errors in PHP 8.0 #27939

Merged
merged 1 commit into from
Jul 14, 2021
Merged

[stable21] Correctly skip suppressed errors in PHP 8.0 #27939

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

@steadybright
Copy link

steadybright commented Jul 13, 2021

Glad to see this is targeted for resolution in 21.0.4! This is the only remaining error message in my Nextcloud log over the last two weeks--and this one error is creating a large log file:

Error: session_start(): Ignoring session_start() because a session is already active at /usr/share/webapps/nextcloud/lib/private/Session/Internal.php#207

buzz

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>
@MichaIng MichaIng merged commit ba1f04d into nextcloud:stable21 Jul 14, 2021
@yan12125 yan12125 deleted the backport/27631/stable21 branch July 14, 2021 12:40
@skjnldsv skjnldsv mentioned this pull request Jul 26, 2021
14 tasks
@skjnldsv skjnldsv mentioned this pull request Aug 3, 2021
12 tasks
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

4 participants