]> source.dussan.org Git - nextcloud-server.git/commit
Correctly skip suppressed errors in PHP 8.0 27939/head
authorChih-Hsuan Yen <yan12125@gmail.com>
Wed, 23 Jun 2021 12:24:21 +0000 (20:24 +0800)
committerChih-Hsuan Yen <yan12125@gmail.com>
Wed, 14 Jul 2021 05:14:30 +0000 (13:14 +0800)
commitbe51d8390b7c35a2914c745ccbacfddbbf3abf89
treec8d737a3421c0f0aa66106510ea85b865c402757
parentce9c2d24711e9a0dff167532c00345249a7f9964
Correctly skip suppressed errors in PHP 8.0

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 https://github.com/nextcloud/server/issues/25807 in PHP 8.0.
For PHP 7.x, https://github.com/nextcloud/server/pull/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 https://github.com/nextcloud/server/issues/25806

Signed-off-by: Chih-Hsuan Yen <yan12125@gmail.com>
lib/private/Log/ErrorHandler.php