Make WordPress Core


Ignore:
Timestamp:
03/28/2010 04:35:42 AM (14 years ago)
Author:
dd32
Message:

Implement the 2nd parameter of json_decode() for back-compat purposes. Returns an associative array instead of an object. Fixes #11963

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/compat.php

    r12491 r13862  
    139139
    140140if ( !function_exists('json_decode') ) {
    141     function json_decode( $string ) {
     141    function json_decode( $string, $assoc_array = false ) {
    142142        global $wp_json;
    143143
     
    147147        }
    148148
    149         return $wp_json->decode( $string );
     149        $res = $wp_json->decode( $string );
     150        if ( $assoc_array )
     151            $res = get_object_vars( $res );
     152        return $res;
    150153    }
    151154}
Note: See TracChangeset for help on using the changeset viewer.