diff options
Diffstat (limited to 'lib/facebook-graph-sdk/src/Facebook/FacebookApp.php')
-rw-r--r-- | lib/facebook-graph-sdk/src/Facebook/FacebookApp.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/facebook-graph-sdk/src/Facebook/FacebookApp.php b/lib/facebook-graph-sdk/src/Facebook/FacebookApp.php index 84956ce..804c9bb 100644 --- a/lib/facebook-graph-sdk/src/Facebook/FacebookApp.php +++ b/lib/facebook-graph-sdk/src/Facebook/FacebookApp.php @@ -1,6 +1,6 @@ <?php /** - * Copyright 2014 Facebook, Inc. + * Copyright 2017 Facebook, Inc. * * You are hereby granted a non-exclusive, worldwide, royalty-free license to * use, copy, modify, and distribute this software in source code or binary @@ -24,6 +24,7 @@ namespace Facebook; use Facebook\Authentication\AccessToken; +use Facebook\Exceptions\FacebookSDKException; class FacebookApp implements \Serializable { @@ -40,10 +41,18 @@ class FacebookApp implements \Serializable /** * @param string $id * @param string $secret + * + * @throws FacebookSDKException */ public function __construct($id, $secret) { - $this->id = $id; + if (!is_string($id) + // Keeping this for BC. Integers greater than PHP_INT_MAX will make is_int() return false + && !is_int($id)) { + throw new FacebookSDKException('The "app_id" must be formatted as a string since many app ID\'s are greater than PHP_INT_MAX on some systems.'); + } + // We cast as a string in case a valid int was set on a 64-bit system and this is unserialised on a 32-bit system + $this->id = (string) $id; $this->secret = $secret; } @@ -84,7 +93,7 @@ class FacebookApp implements \Serializable */ public function serialize() { - return serialize([$this->id, $this->secret]); + return implode('|', [$this->id, $this->secret]); } /** @@ -94,7 +103,7 @@ class FacebookApp implements \Serializable */ public function unserialize($serialized) { - list($id, $secret) = unserialize($serialized); + list($id, $secret) = explode('|', $serialized); $this->__construct($id, $secret); } |