Skip to content

Commit 6880fdd

Browse files
committed
Merge remote-tracking branch 'origin/develop'
2 parents 5bfcc7d + 2c22142 commit 6880fdd

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# Changelog
22

3+
## 2.6.5
4+
5+
- Fixed an issue with (in|de)crement cache values when using igbinary
6+
7+
## 2.6.4
8+
9+
- Prevent some deprecation notices
10+
- Fixed an issue with (in|de)crement cache values
11+
312
## 2.6.3
413

514
- Switch to `E_USER_DEPRECATED` instead of `_doing_it_wrong()` in drop-in

includes/object-cache.php

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Redis Object Cache Drop-In
44
* Plugin URI: https://wordpress.org/plugins/redis-cache/
55
* Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
6-
* Version: 2.6.3
6+
* Version: 2.6.5
77
* Author: Till Krüss
88
* Author URI: https://objectcache.pro
99
* License: GPLv3
@@ -354,6 +354,7 @@ function wp_cache_add_non_persistent_groups( $groups ) {
354354
/**
355355
* Object cache class definition
356356
*/
357+
#[AllowDynamicProperties]
357358
class WP_Object_Cache {
358359
/**
359360
* The Redis client.
@@ -2411,12 +2412,13 @@ public function increment( $key, $offset = 1, $group = 'default' ) {
24112412
}
24122413

24132414
try {
2414-
$value = (int) $this->parse_redis_response( $this->redis->get( $derived_key ) );
2415+
$value = (int) $this->parse_redis_response( $this->maybe_unserialize( $this->redis->get( $derived_key ) ) );
24152416
$value += $offset;
24162417
$result = $this->parse_redis_response( $this->redis->set( $derived_key, $this->maybe_serialize( $value ) ) );
24172418

24182419
if ( $result ) {
24192420
$this->add_to_internal_cache( $derived_key, $value );
2421+
$result = $value;
24202422
}
24212423
} catch ( Exception $exception ) {
24222424
$this->handle_exception( $exception );
@@ -2472,12 +2474,13 @@ public function decrement( $key, $offset = 1, $group = 'default' ) {
24722474
}
24732475

24742476
try {
2475-
$value = (int) $this->parse_redis_response( $this->redis->get( $derived_key ) );
2477+
$value = (int) $this->parse_redis_response( $this->maybe_unserialize( $this->redis->get( $derived_key ) ) );
24762478
$value -= $offset;
24772479
$result = $this->parse_redis_response( $this->redis->set( $derived_key, $this->maybe_serialize( $value ) ) );
24782480

24792481
if ( $result ) {
24802482
$this->add_to_internal_cache( $derived_key, $value );
2483+
$result = $value;
24812484
}
24822485
} catch ( Exception $exception ) {
24832486
$this->handle_exception( $exception );
@@ -2576,7 +2579,6 @@ function ( $keys ) {
25762579
*
25772580
* @param string $key The key under which to store the value, pre-sanitized.
25782581
* @param string $group The group value appended to the $key, pre-sanitized.
2579-
*
25802582
* @return string
25812583
*/
25822584
public function build_key( $key, $group = 'default' ) {
@@ -2595,7 +2597,6 @@ public function build_key( $key, $group = 'default' ) {
25952597
*
25962598
* @param string $key The key under which to store the value, pre-sanitized.
25972599
* @param string $group The group value appended to the $key, pre-sanitized.
2598-
*
25992600
* @return string
26002601
*/
26012602
public function fast_build_key( $key, $group = 'default' ) {
@@ -2606,15 +2607,15 @@ public function fast_build_key( $key, $group = 'default' ) {
26062607
$salt = defined( 'WP_REDIS_PREFIX' ) ? trim( WP_REDIS_PREFIX ) : '';
26072608

26082609
$prefix = $this->is_global_group( $group ) ? $this->global_prefix : $this->blog_prefix;
2609-
$prefix = trim( $prefix, '_-:$' );
2610+
$prefix = trim( (string) $prefix, '_-:$' );
26102611

26112612
return "{$salt}{$prefix}:{$group}:{$key}";
26122613
}
26132614

26142615
/**
26152616
* Replaces the set group separator by another one
26162617
*
2617-
* @param string $part The string to sanitize.
2618+
* @param string $part The string to sanitize.
26182619
* @return string Sanitized string.
26192620
*/
26202621
protected function sanitize_key_part( $part ) {

readme.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: redis, object cache, caching, performance, relay
55
Requires at least: 4.6
66
Tested up to: 6.8
77
Requires PHP: 7.2
8-
Stable tag: 2.6.3
8+
Stable tag: 2.6.5
99
License: GPLv3
1010
License URI: https://www.gnu.org/licenses/gpl-3.0.html
1111

@@ -61,6 +61,15 @@ Redis Object Cache has various WP CLI commands, for more information run `wp hel
6161

6262
== Changelog ==
6363

64+
= 2.6.5 =
65+
66+
- Fixed an issue with (in|de)crement cache values when using igbinary
67+
68+
= 2.6.4 =
69+
70+
- Prevent some deprecation notices
71+
- Fixed an issue with (in|de)crement cache values
72+
6473
= 2.6.3 =
6574

6675
- Switch to `E_USER_DEPRECATED` instead of `_doing_it_wrong()` in drop-in

redis-cache.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Plugin Name: Redis Object Cache
44
* Plugin URI: https://wordpress.org/plugins/redis-cache/
55
* Description: A persistent object cache backend powered by Redis. Supports Predis, PhpRedis, Relay, replication, sentinels, clustering and WP-CLI.
6-
* Version: 2.6.3
6+
* Version: 2.6.5
77
* Text Domain: redis-cache
88
* Domain Path: /languages
99
* Network: true

0 commit comments

Comments
 (0)