You are here

function fb_json_decode in Drupal for Facebook 7.4

Wrapper because PHP versions differ.

3 calls to fb_json_decode()
fb_api in ./fb.module
Facebook's older api methods.
fb_http_parse_response in ./fb.module
Helper to parse data return from fb graph API.
fb_parse_signed_request in ./fb.module
Based on https://developers.facebook.com/docs/authentication/signed_request/ (facebook has removed that documentation and not replaced it!)

File

./fb.module, line 1209

Code

function fb_json_decode($json, $assoc = TRUE, $depth = 512) {
  if (variable_get(FB_VAR_USE_JSON_BIGINT, defined('JSON_BIGINT_AS_STRING'))) {

    // BIGINT prevents facebook ids in scientific notation.
    return json_decode($json, $assoc, $depth, JSON_BIGINT_AS_STRING);
  }
  else {

    // This regexp attempt to convert long integers into strings.
    // Otherwise json_decode will output scientific notation.
    $json = preg_replace('/"([^"]+)":(\\d{9}\\d*)/', '"$1":"$2"', $json);
    return json_decode($json, $assoc, $depth);
  }
}