-
Notifications
You must be signed in to change notification settings - Fork 67
[SITE-5390] Add fixes for PHP 8.4.8 compatibility #525
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -439,6 +439,27 @@ | |
| */ | ||
| public $last_triggered_error = ''; | ||
|
|
||
| /** | ||
| * The Redis client instance | ||
| * | ||
| * @var Redis|RedisCluster|Predis\Client|null | ||
| */ | ||
| public $redis = null; | ||
|
|
||
| /** | ||
| * Error message when Redis cannot connect | ||
| * | ||
| * @var string | ||
| */ | ||
| public $missing_redis_message = ''; | ||
|
|
||
| /** | ||
| * Global prefix for cache keys | ||
| * | ||
| * @var string | ||
| */ | ||
| public $global_prefix = ''; | ||
|
|
||
| /** | ||
| * Whether or not to use true cache groups, instead of flattening. | ||
| * | ||
|
|
@@ -1257,11 +1278,11 @@ | |
| $redis_server = [ | ||
| // Don't use WP methods to sanitize the host due to plugin loading issues with other caching methods. | ||
| // @phpcs:ignore WordPressVIPMinimum.Functions.StripTags.StripTagsOneParameter,WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | ||
| 'host' => strip_tags( $_SERVER['CACHE_HOST'] ), | ||
| 'port' => ! empty( $_SERVER['CACHE_PORT'] ) ? intval( $_SERVER['CACHE_PORT'] ) : $port, | ||
| // Don't attempt to sanitize passwords as this can break authentication. | ||
| // @phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized | ||
| 'auth' => ! empty( $_SERVER['CACHE_PASSWORD'] ) ? $_SERVER['CACHE_PASSWORD'] : null, | ||
| 'database' => ! empty( $_SERVER['CACHE_DB'] ) ? intval( $_SERVER['CACHE_DB'] ) : $database, | ||
| ]; | ||
| } else { | ||
|
|
@@ -1276,7 +1297,7 @@ | |
| if ( file_exists( $redis_server['host'] ) && 'socket' === filetype( $redis_server['host'] ) ) { // unix socket connection. | ||
| // port must be null or socket won't connect. | ||
| unset( $redis_server['port'] ); | ||
| $port = -1; | ||
| $port = null; | ||
| } | ||
|
|
||
| $defaults = [ | ||
|
|
@@ -1335,10 +1356,8 @@ | |
| $redis->$method( $client_parameters[ $key ] ); | ||
| } catch ( RedisException $e ) { | ||
|
|
||
| /** | ||
| * PhpRedis throws an Exception when it fails a server call. | ||
| * To prevent WordPress from fataling, we catch the Exception. | ||
| */ | ||
| // PhpRedis throws an Exception when it fails a server call. | ||
| // To prevent WordPress from fataling, we catch the Exception. | ||
| throw new Exception( $e->getMessage(), $e->getCode(), $e ); // phpcs:ignore WordPress.Security.EscapeOutput.ExceptionNotEscaped | ||
| } | ||
| } | ||
|
|
@@ -1373,10 +1392,8 @@ | |
| return $retval; | ||
| } catch ( Exception $e ) { | ||
| $retry_exception_messages = $this->retry_exception_messages(); | ||
| /** | ||
| * PhpRedis throws an Exception when it fails a server call. | ||
| * To prevent WordPress from fataling, we catch the Exception. | ||
| */ | ||
| // PhpRedis throws an Exception when it fails a server call. | ||
| // To prevent WordPress from fataling, we catch the Exception. | ||
|
Comment on lines
+1395
to
+1396
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔢 same as above |
||
| if ( $this->exception_message_matches( $e->getMessage(), $retry_exception_messages ) ) { | ||
|
|
||
| $this->_exception_handler( $e ); | ||
|
|
@@ -1402,7 +1419,7 @@ | |
| $col1 = 'option_name'; | ||
| $col2 = 'option_value'; | ||
| } | ||
| $wpdb->query( "INSERT IGNORE INTO {$table} ({$col1},{$col2}) VALUES ('wp_redis_do_redis_failback_flush',1)" ); | ||
|
Check warning on line 1422 in object-cache.php
|
||
| $this->do_redis_failback_flush = true; | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment change will break Pantheon WP Coding Standards in 3.0