Make WordPress Core

Opened 9 years ago

Last modified 7 years ago

#31600 reviewing defect (bug)

WP_Object_Cache incr & decr can use a more strict type checking on offset

Reported by: jipmoors's profile jipmoors Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: Future Release Priority: normal
Severity: minor Version: 3.3
Component: Cache API Keywords: has-patch
Focuses: Cc:


While working on improving the unit tests for related ticket #28759 I wrote some tests that could not pass on the current code: passing an non-empty array as offset.

Despite of it being an edge case, I want to have my tests pass, so I provide a patch.

Attachments (2)

31600-incr_decr_offset_type_check.diff (873 bytes) - added by jipmoors 9 years ago.
Type check on offset
31600-incr_decr_offset_type_check-2.diff (697 bytes) - added by jipmoors 8 years ago.
Simplified the code.

Download all attachments as: .zip

Change History (7)

9 years ago

Type check on offset

#1 @jipmoors
9 years ago

  • Keywords has-patch added
  • Severity changed from normal to minor

#2 @johnbillion
9 years ago

Which tests/assertions in your patch on #28759 fail currently?

#3 @johnbillion
9 years ago

  • Milestone changed from Awaiting Review to Future Release

#4 @jipmoors
9 years ago

Test increment with an array with entries.

wp_cache_set( $key, 2 );
$this->assertEquals( 2, wp_cache_incr( $key, array('') ) );

Results in 3 instead of 2.

Last edited 7 years ago by SergeyBiryukov (previous) (diff)

8 years ago

Simplified the code.

#5 @SergeyBiryukov
7 years ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing
Note: See TracTickets for help on using tickets.