[wp-trac] [WordPress Trac] #6784: options with content in strange languages do not deserialize properly

WordPress Trac wp-trac at lists.automattic.com
Sat Apr 19 21:19:56 GMT 2008


#6784: options with content in strange languages do not deserialize properly
------------------------+---------------------------------------------------
 Reporter:  Olav Kolbu  |       Owner:  anonymous                              
     Type:  defect      |      Status:  new                                    
 Priority:  normal      |   Milestone:  2.5.1                                  
Component:  General     |     Version:  2.5                                    
 Severity:  normal      |    Keywords:  deserialize, get_option, character sets
------------------------+---------------------------------------------------
 Put this in a php-page that has access to the get_option()/update_option()
 fns and load page TWICE.

 $test = get_option('my_test');
 if ( is_bool($test) ) {
    print "1st time<br>";
    $test = array();
    $test[] = 'ي';
    update_option('my_test', $test);
    print 'Arabic : '.gettype(get_option('my_test')).'<br>';
 } else {
    print "2nd time<br>";
    print "got a ".gettype($test)." which looks like '$test'";
 }

 Note that the content of the string on line 5 is an arabic character. If
 you're having troubles regenerating it, print & # 1610 ; (without
 spaces...) on a webpage and cut'n'paste it from there. I have also
 attached it to this bug report, I hope.

 First time the page loads, the output is:

 1st time
 Arabic : array

 Which is what you would expect. Note specifically that the array tested is
 the one that is stored and then fetched again, not the original array.

 Now reload page and you get:

 2nd time
 got a string which looks like 'a:1:{i:0;s:2:"?";}'

 So the backend didn't deserialize the array this time around. Now, I can
 work around this feature/bug in my own plugin-code by never storing
 strings with strange characters, but this also bites me when I use the
 MagpieRSS caching features, as the feed stored may contain strange
 characters and I can't control the content of those.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6784>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list