'This error comming on the facebookApp.php Give me solution of this error
Error:
A PHP Error was encountered Severity: 8192
Message: Facebook\FacebookApp implements the Serializable interface, which is deprecated. Implement __serialize() and __unserialize() instead (or in addition, if support for old PHP versions is necessary)
Filename: facebook/FacebookApp.php
Line Number: 29
FacebookApp.php:
namespace Facebook;
use Facebook\Authentication\AccessToken;
use Facebook\Exceptions\FacebookSDKException;
class FacebookApp implements \Serializable
{
/**
* @var string The app ID.
*/
protected $id;
/**
* @var string The app secret.
*/
protected $secret;
/**
* @param string $id
* @param string $secret
*
* @throws FacebookSDKException
*/
public function __construct($id, $secret)
{
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;
}
/**
* Returns the app ID.
*
* @return string
*/
public function getId()
{
return $this->id;
}
/**
* Returns the app secret.
*
* @return string
*/
public function getSecret()
{
return $this->secret;
}
/**
* Returns an app access token.
*
* @return AccessToken
*/
public function getAccessToken()
{
return new AccessToken($this->id . '|' . $this->secret);
}
/**
* Serializes the FacebookApp entity as a string.
*
* @return string
*/
public function serialize()
{
return implode('|', [$this->id, $this->secret]);
}
/**
* Unserializes a string as a FacebookApp entity.
*
* @param string $serialized
*/
public function unserialize($serialized)
{
list($id, $secret) = explode('|', $serialized);
$this->__construct($id, $secret);
}
}
Solution 1:[1]
Error code 8192 means that the syntax is deprecated, but not erroneous. This means you only get a warning, and your app should run just fine.
In order to get rid of the warning, you simply have to do as the message says and implement __serialize() and __unserialize(). More info on this in the docs and some useful hints.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | M B |
