mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-03 19:41:39 +00:00
Administration: Guard against false transient key in get_cached_events().
Inside `WP_Community_Events::get_cached_events()`, `WP_Community_Events::get_events_transient_key()` is used to retrieve the transient key name, based on the user's location. However, the transient key can potentially return `false`, resulting in a call to `get_site_transient()` with the `$key` being `false`. This change first attempts to evaluate and guard against a `false` return from `WP_Community_Events::get_events_transient_key()`. The result is an early `false` return from `WP_Community_Events::get_cached_events()`. Props malthert, rafiahmedd, audrasjb, costdev. Fixes #55888. git-svn-id: https://develop.svn.wordpress.org/trunk@54338 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -353,8 +353,12 @@ class WP_Community_Events {
|
||||
* on success, false on failure.
|
||||
*/
|
||||
public function get_cached_events() {
|
||||
$cached_response = get_site_transient( $this->get_events_transient_key( $this->user_location ) );
|
||||
$transient_key = $this->get_events_transient_key( $this->user_location );
|
||||
if ( ! $transient_key ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$cached_response = get_site_transient( $transient_key );
|
||||
if ( isset( $cached_response['events'] ) ) {
|
||||
$cached_response['events'] = $this->trim_events( $cached_response['events'] );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user