[wp-trac] [WordPress Trac] #30430: WP_Object_Cache does not properly cache objects nested in arrays
WordPress Trac
noreply at wordpress.org
Fri Jan 2 15:35:02 UTC 2015
#30430: WP_Object_Cache does not properly cache objects nested in arrays
-------------------------------------------------+-------------------------
Reporter: jamesgol | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting
Component: Cache API | Review
Severity: normal | Version: 2.0
Keywords: reporter-feedback has-patch needs- | Resolution:
testing needs-unit-tests | Focuses:
-------------------------------------------------+-------------------------
Comment (by jamesgol):
I've been sick so I haven't had a chance to get back to this but I just
looked over the unit tests that @valendesigns wrote and it does look like
it covers my test but it is missing the crucial point of modifying the
return of a cache_get and comparing the original data with what is in the
cache.
For your array-of-objects test you should be able to change it to:
{{{
// Verify array of objects set
wp_cache_set( 'array-of-objects', $expected );
$new = wp_cache_get( 'array-of-objects' );
unset( $new["test"]->test2 );
$this->assertEquals( $expected['test']->test2, 'the' );
}}}
I'll attach a simple plugin that demos this with a shortcode.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30430#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list