diff --git a/README.md b/README.md index 027c998..6350396 100644 --- a/README.md +++ b/README.md @@ -105,6 +105,7 @@ There's a known issue with WordPress `alloptions` cache design. Specifically, a ## Changelog ## ### Latest ### +* Bug fix: Removes exception loop caused by `esc_html` in `_exception_handler()` [[421](https://github.com/pantheon-systems/wp-redis/pull/421)] ### 1.4.1 (May 11, 2023) ### * Bug fix: `wp_cache_flush_runtime` should only clear the local cache [[413](https://github.com/pantheon-systems/wp-redis/pull/413)] diff --git a/object-cache.php b/object-cache.php index c607bd1..05c6526 100644 --- a/object-cache.php +++ b/object-cache.php @@ -1470,7 +1470,9 @@ protected function _exception_handler( $exception ) { try { $this->last_triggered_error = 'WP Redis: ' . $exception->getMessage(); // Be friendly to developers debugging production servers by triggering an error. - trigger_error( esc_html( $this->last_triggered_error ), E_USER_WARNING ); // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error + + // phpcs:ignore WordPress.PHP.DevelopmentFunctions.error_log_trigger_error,WordPress.Security.EscapeOutput.OutputNotEscaped + trigger_error( $this->last_triggered_error, E_USER_WARNING ); } catch ( PHPUnit_Framework_Error_Warning $e ) { // phpcs:ignore Generic.CodeAnalysis.EmptyStatement.DetectedCatch // PHPUnit throws an Exception when `trigger_error()` is called. To ensure our tests (which expect Exceptions to be caught) continue to run, we catch the PHPUnit exception and inspect the RedisException message. } diff --git a/readme.txt b/readme.txt index 58fb84b..1134400 100644 --- a/readme.txt +++ b/readme.txt @@ -103,6 +103,7 @@ There's a known issue with WordPress `alloptions` cache design. Specifically, a == Changelog == = Latest = +* Bug fix: Removes exception loop caused by `esc_html` in `_exception_handler()` [[421](https://github.com/pantheon-systems/wp-redis/pull/421)] = 1.4.1 (May 11, 2023) = * Bug fix: `wp_cache_flush_runtime` should only clear the local cache [[413](https://github.com/pantheon-systems/wp-redis/pull/413)]