1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: Bug 30430 |
---|
4 | Description: Demonstrate caching of arrays in objects and objects in arrays |
---|
5 | Author: James Golovich |
---|
6 | */ |
---|
7 | |
---|
8 | add_shortcode( 'bug30430', 'jmg_show_bug' ); |
---|
9 | |
---|
10 | function jmg_show_bug() { |
---|
11 | $a = array(); |
---|
12 | $a['test'] = new StdClass(); |
---|
13 | $a['test']->test = 'the'; |
---|
14 | $a['test']->test2 = 'the'; |
---|
15 | $a['test']->test3 = 'the'; |
---|
16 | |
---|
17 | wp_cache_set( 'jmg-array-of-obj', $a ); |
---|
18 | $new = wp_cache_get( 'jmg-array-of-obj' ); |
---|
19 | unset( $new["test"]->test2 ); |
---|
20 | |
---|
21 | return "Value of test2 (expected is 'the'): " . $a['test']->test2 . "</br>"; |
---|
22 | |
---|
23 | } |
---|