facebook credit callback, order_id changes format changes after moving to a new server

只谈情不闲聊 提交于 2019-12-11 15:25:25

问题


I've just migrated to a new server, still linux based. After moving I saw a change in behavior - for some reason the order id send by the facebook credits callback in the payload formatted as : 2.6040261734251E+14 instead of : 143121239125639 (these are not necessarily the same order numbers, just refer to the format)...

The format arrives like that directly when taken from the $_REQUEST, and before the DB insert... Anyone has any idea maybe why would the format change/arrive like that? Thanks!

--- edit --- I'm getting the variable from the signed request using the parse_signed_request function:

    function parse_signed_request($signed_request, $secret) {
  list($encoded_sig, $payload) = explode('.', $signed_request, 2);

  // decode the data
  $sig = base64_url_decode($encoded_sig);
  $data = json_decode(base64_url_decode($payload), true);

  if (strtoupper($data['algorithm']) !== 'HMAC-SHA256') {
    error_log('Unknown algorithm. Expected HMAC-SHA256');
    mail('example@example.com','server error','Unknown algorithm. Expected HMAC-SHA256');
    return null;
  }

  // check signature
  $expected_sig = hash_hmac('sha256', $payload, $secret, $raw = true);
  if ($sig !== $expected_sig) {
    error_log('Bad Signed JSON signature!');
    return null;
  }

  return $data;
}

As Charley P. noticed, i'm indeed using a 32 bit server instead of the 64 bit previous server. Could that somehow ruin the function above which uses

json_decode(base64_url_decode($payload), true);

Thanks again...


回答1:


Your old server must have been 64bit and your new server is 32bit

Try to use the original numbers as string



来源:https://stackoverflow.com/questions/8222942/facebook-credit-callback-order-id-changes-format-changes-after-moving-to-a-new

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!