[wp-trac] [WordPress Trac] #28480: is_serialized() returns wrong value

WordPress Trac noreply at wordpress.org
Sat Jun 7 14:00:45 UTC 2014

#28480: is_serialized() returns wrong value
 Reporter:  extendwings   |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Database      |    Version:  3.9.1
 Severity:  normal        |   Keywords:
  Focuses:                |
 This is the first time I create ticket in WordPress Trac. I hope this
 ticket will go well!

 When I call `get_user_meta( $user_id, 'wp_capabilities' )`, My expected
 returning is:
         [administrator] => 1

 But contrary to expectations, it returns `a:1:{s:11:"contributor";b:1;}`.
 (cf: [http://ja.forums.wordpress.org/topic/128564 Japanese Forum Topic])
 As a result of inspection, I found a bug in `is_serialized()` at the
 following  conditional expression:
 if ( false !== $semicolon && $semicolon < 3 )

 In this case, `a:1:{s:11:"contributor";b:1;}` includes only '''2'''
 semicolons, but this is valid serialized string! So if first argument of
 `is_serialized()`, $data, terminated in `}`, I guess we have to count up
 $semicolon by `++$semicolon;`.

Ticket URL: <https://core.trac.wordpress.org/ticket/28480>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform

More information about the wp-trac mailing list