json_encode and json_decode functions in compat.php do not safely include class-json.php
|Reported by:||alexkingorg||Owned by:|
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.