Facebook PHP SDK 3 won't work on 32-bit system, facebook ids treated as int and can be > 2147483647, best solution?

Asked
Active3 hr before
Viewed126 times

7 Answers

facebook
90%

Stack Overflow Public questions & answers , Stack Overflow for Teams Where developers & technologists share private knowledge with coworkers ,Asking for help, clarification, or responding to other answers., Stack Overflow help chat

Find this line

$user = $signed_request['user_id'];
load more v
88%

I'm using facebooks PHP SDK version 3. It turns out that it won't work on 32-bit system as the SDK casts the facebook ids to integers and the ids can be larger than 2147483647 that is a 32-bit systems max integer value.,And it works. Int isn't able to handle such a long user ids on 32bit systems, that's why is it making problems,This is common issue among mobile browsers and you will find that it would also be in some android devices.,Since Facebook is always changing their API, the documentation is inevitably lacking and/or out of date. If you are looking up viral information, you going to find a lot of pages that say they have been deprecated.

Find this line

$user = $signed_request['user_id'];

and change it to

$user = (string) $signed_request['user_id'];

and also find

$user = $this - > getUserFromAccessToken();

and change it to

$user = (string) $this - > getUserFromAccessToken();

and also find

$user = $this - > getPersistentData('user_id', $default = 0);

change it to

$user = (string) $this - > getPersistentData('user_id', $default = 0);
load more v
72%

/{page-id}/videos/uploaded shows all videos that were published to Facebook by this page.,/{page-id}/videos shows all videos this page is tagged in.,The description of the video, used as the accompanying status message in any feed story. This parameter can contain mentions of other Facebook Pages using the following syntax:,Usage of this feature is subject to review but by using Pages you are an admin of (both to make the API call, and to be used in a mention), and an app you are a developer of, you can test it for yourself before review.

GET / v12 .0 / {
   page - id
}
/videos HTTP/
1.1
Host: graph.facebook.com
/* PHP SDK v5.0.0 */
/* make the API call */
try {
   // Returns a `Facebook\FacebookResponse` object
   $response = $fb - > get(
      '/{page-id}/videos',
      '{access-token}'
   );
} catch (Facebook\ Exceptions\ FacebookResponseException $e) {
   echo 'Graph returned an error: '.$e - > getMessage();
   exit;
} catch (Facebook\ Exceptions\ FacebookSDKException $e) {
   echo 'Facebook SDK returned an error: '.$e - > getMessage();
   exit;
}
$graphNode = $response - > getGraphNode();
/* handle the result */
/* make the API call */
FB.api(
   "/{page-id}/videos",
   function(response) {
      if (response && !response.error) {
         /* handle the result */
      }
   }
);
/* make the API call */
new GraphRequest(
   AccessToken.getCurrentAccessToken(),
   "/{page-id}/videos",
   null,
   HttpMethod.GET,
   new GraphRequest.Callback() {
      public void onCompleted(GraphResponse response) {
         /* handle the result */
      }
   }
).executeAsync();
/* make the API call */
FBSDKGraphRequest * request = [
   [FBSDKGraphRequest alloc]
   initWithGraphPath: @ "/{page-id}/videos"
   parameters: params
   HTTPMethod: @ "GET"
];
[request startWithCompletionHandler: ^ (FBSDKGraphRequestConnection * connection,
   id result,
   NSError * error) {
   // Handle the result
}];
load more v
65%

Note: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB. ,Note: The results of this function are cached. See clearstatcache() for more details.,As of PHP 5.0.0, this function can also be used with some URL wrappers. Refer to Supported Protocols and Wrappers to determine which wrappers support stat() family of functionality., Returns the size of the file in bytes, or false (and generates an error of level E_WARNING) in case of an error.

load more v
75%

Numbers themselves can be infinitely large, but our computers have limited computer memory. This can lead to problems when working with numbers in a programming language.,Working with numbers in PHP seems to be a trivial concept, but it can be quite confusing. It looks easy at first because PHP provides automatic type conversion. For example, you can assign an integer value to a variable, and the type of that variable will be an integer. On the next line, you can assign a string to the same variable, and the type will change to a string. Unfortunately, this automatic conversion can sometimes break your code.,Of course, this functionality comes at a cost—using BCMath is significantly slower than the built-in number types in PHP. It's best to use the built-in numeric types unless you need the extra precision and range. ,In the last case, the hexadecimal string "0xfedd24" is not converted to its decimal value because PHP 7 does not consider it to be a valid numerical string.

PHP will implicitly cast any valid numerical string to a number when the need arises. The following examples should help you understand this process better.

< ? php

$num = "3258712" + 12380;
// Output: int(3271092)
var_dump($num);

$num = "3258712" + "12380";
// Output: int(3271092)
var_dump($num);

$num = 3258712 + "12380";
// Output: int(3271092)
var_dump($num);

$num = 3258712 * "12380";
// Output: float(40342854560)
var_dump($num);

$num = 3258712 / "12380";
// Output: float(263.2239095315)
var_dump($num);

$num = 3258712 / "8";
// Output: int(407339)
var_dump($num);

$num = "53.9e4" + 10;
// Output: float(539010)
var_dump($num);

$num = "398.328" + 10;
// Output: float(408.328)
var_dump($num);

$num = "398328" + 0xfedd24;
// Output: int(17101084)
var_dump($num);

$num = 398328 + "0xfedd24";
// Output: int(398328)
var_dump($num);

?
>
load more v
40%

Dies ist, was ich mit meinem begrenzten Verständnis von Regex und dieser Site gefunden habe. finden:

Dies ist, was ich mit meinem begrenzten Verständnis von Regex und dieser Site gefunden habe. finden:

TABLE_( * )\(( * ),
load more v
22%

Data types specify the kinds of values that particular variables will store when you are writing a program. The data type also determines what operations can be performed on the data.,Now that you know about the different primitive data types, we will go over how to assign these types to variables in Go.,And finally the data type float64:,There are also a couple of alias number types, which assign useful names to specific data types:

Usually, in math, we can combine numbers from different types, and get some kind of an answer. We may want to add 5 to π, for example:

5 + π
load more v