[wp-trac] [WordPress Trac] #11827: json_encode and json_decode functions in compat.php do not safely include class-json.php

WordPress Trac wp-trac at lists.automattic.com
Fri Jan 8 19:51:19 UTC 2010


#11827: json_encode and json_decode functions in compat.php do not safely include
class-json.php
--------------------------+-------------------------------------------------
 Reporter:  alexkingorg   |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  high          |   Milestone:  Unassigned
Component:  General       |     Version:            
 Severity:  major         |    Keywords:            
--------------------------+-------------------------------------------------
 The implementation of the json_encode and decode compatibility functions
 is incompatible with plugins that already included the Services_JSON class
 (such as my Twitter Tools plugin).

 Though I wrapped the inclusion of the Services_JSON in a check in my
 plugin to try to keep it from being loaded twice, the conditional loading
 of class-json.php from compat.php happens after plugins is loaded and
 creates a fatal error by declaring the class a second time.

 Attached are two patches, one that patches the class file in the same way
 class-snoopy.php handles this (recommended), the other patches compat.php.

 Unfortunately, since this is in the wild already I believe plugin/theme
 developers will need to work around this. Suggestion to plugin/theme devs:
 do the same function definition approach that is in WP 2.9 rather than
 version sniffing.

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


More information about the wp-trac mailing list