Buyer JSON encoded as an int.

FLindblomMember From: SwedenRegistered: 2008-02-26 PostsWeb site : 278

OK, this might be something I'm doing wrong I suppose but it never happened to me before on my app.

My script handler credits based on the script for example on github.

This is where to get the UID buyer:

According to my logs, I was only this code return something like uid = 1.0000001234567 E + 14.

So now I try this:

That is still checked. But it would be too much to have json FB encode the UID as string? I'm sure that not just one into this, I don't know if it's too late to convert (String) at this point or not. If the uid bigint broken early as in encoding certainly modify json_decode.

But I suppose it were long ago if it was, so I hope my revision to work the next time a user with a UID greater comes along.

Jonny5alive_ _ A Moderator But Do Not Have Note: 2007-11-07 Posts: 5339

I think the template string is certainly most appropriate for UID.

You can try this code to deal with this:

Make your account on facebook.stackoverflow.com today!
Archive for Facebook Platform Developer ForumFLindblomMember From: SwedenRegistered: 2008-02-26 PostsWeb site : 278

But as it turns out, this data is already corrupted before you convert it to a string. Probably by json_decode itself.

I did my credits script callback to die when he finds. "your user ID, my journal file is currently full of errors. Fortunately it dies bashlv first, then only one person lost credits so far.

So I guess I get number from JSON encoded string manually, make it a string. Messy. I'm surprised that I'm the only person with this problem.

FLindblomMember From: SwedenRegistered: 2008-02-26 PostsWeb site : 278

This might help someone else who runs into this problem, you can change the parse_signed_request function in the code example:

Ugly, but it works. Parse_signed_request () has been modified now returns an array, so you need to do this:

FritzingtonNew Memberregistered: 2011-02-22 Posts: 5

PHP development version now supports an optional parameter to json_decode, JSON_BIGINT_AS_STRING, which fixes it.

Http://php.net/manual/en/function.json-decode.php

So he said, Facebook send uids are ints and strings is not the way I believe Twitter.

Last edited by Fritzington (2011-02-22 08: 30: 58)

PitstopbossNew Memberregistered: 2011-05-17 Posts: 6

Hello

Some people seem to get it now ... I bump it so more people are aware of the workaround (until someone from Facebook gets to store these as strings ints)

I was pulling my hair out every day!

LyalenaNew Memberregistered: 2011-08-24 Posts: 7

Hi, same problem for me.
I write my own email function:

$ Search = array (' {', ' "');
$ Replace = array (', ',);
$ Step_one = str_replace ($ search, $ replace, $ _ REQUEST [' order_details ']);
$ Step_two = explode ("", $ step_one);
$ Uid = null;
Foreach ($ step_two as $ = > $ val) {
$ Step_three = explode (': ', $ val);
If ($ step_three [0] == ' buyer ') {
$ Uid = $ step_three [1];
}
}

It works well, even if it is not very good ...

DXWebdesignsA new Member From: Leeds, UKRegistered: 2011-04-05site Posts: 111

This might help someone else who runs into this problem, you can change the parse_signed_request function in the code example:

Ugly, but it works. Parse_signed_request () has been modified now returns an array, so you need to do this:

This did it for mesmile

Custom CMS systems, MiniSites, applications or games on Facebook 7 countries around the world.
Application development and support - need a quote?
DXWebdesigns - DXWebdesigns on Facebook