Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save henkvalk/c224a6a25af38b1b1284b40a316451bc to your computer and use it in GitHub Desktop.
Save henkvalk/c224a6a25af38b1b1284b40a316451bc to your computer and use it in GitHub Desktop.
facebook/php-business-sdk compatible with php8.1
diff --git a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/AdsPixelSettings.php b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/AdsPixelSettings.php
index f995a18b..be3abcb6 100644
--- a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/AdsPixelSettings.php
+++ b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/AdsPixelSettings.php
@@ -151,7 +151,7 @@ class AdsPixelSettings implements ArrayAccess {
* @param integer $offset Offset
* @return boolean
*/
- public function offsetExists($offset) {
+ public function offsetExists($offset) :bool {
return isset($this->container[$offset]);
}
@@ -160,7 +160,7 @@ class AdsPixelSettings implements ArrayAccess {
* @param integer $offset Offset
* @return mixed
*/
- public function offsetGet($offset) {
+ public function offsetGet($offset):mixed {
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
@@ -170,7 +170,7 @@ class AdsPixelSettings implements ArrayAccess {
* @param mixed $value Value to be set
* @return void
*/
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value):void {
if (is_null($offset)) {
$this->container[] = $value;
} else {
@@ -183,7 +183,7 @@ class AdsPixelSettings implements ArrayAccess {
* @param integer $offset Offset
* @return void
*/
- public function offsetUnset($offset) {
+ public function offsetUnset($offset) :void {
unset($this->container[$offset]);
}
diff --git a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Content.php b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Content.php
index 75087f92..d3c74e5a 100644
--- a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Content.php
+++ b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Content.php
@@ -53,7 +53,7 @@ class Content implements ArrayAccess {
* Get Product Id.
* @return string Product Id
*/
- public function getProductId() {
+ public function getProductId():bool {
return $this->container['product_id'];
}
@@ -205,7 +205,7 @@ class Content implements ArrayAccess {
* @param integer $offset Offset
* @return boolean
*/
- public function offsetExists($offset) {
+ public function offsetExists($offset):bool {
return isset($this->container[$offset]);
}
@@ -214,7 +214,7 @@ class Content implements ArrayAccess {
* @param integer $offset Offset
* @return mixed
*/
- public function offsetGet($offset) {
+ public function offsetGet($offset):mixed {
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
@@ -224,7 +224,7 @@ class Content implements ArrayAccess {
* @param mixed $value Value to be set
* @return void
*/
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value):void {
if (is_null($offset)) {
$this->container[] = $value;
} else {
@@ -237,7 +237,7 @@ class Content implements ArrayAccess {
* @param integer $offset Offset
* @return void
*/
- public function offsetUnset($offset) {
+ public function offsetUnset($offset):void {
unset($this->container[$offset]);
}
diff --git a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/CustomData.php b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/CustomData.php
index d4c54980..a1296ec0 100644
--- a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/CustomData.php
+++ b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/CustomData.php
@@ -358,7 +358,7 @@ class CustomData implements ArrayAccess {
* @param integer $offset Offset
* @return boolean
*/
- public function offsetExists($offset) {
+ public function offsetExists($offset):bool {
return isset($this->container[$offset]);
}
@@ -367,7 +367,7 @@ class CustomData implements ArrayAccess {
* @param integer $offset Offset
* @return mixed
*/
- public function offsetGet($offset) {
+ public function offsetGet($offset):mixed {
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
@@ -377,7 +377,7 @@ class CustomData implements ArrayAccess {
* @param mixed $value Value to be set
* @return void
*/
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value):void {
if (is_null($offset)) {
$this->container[] = $value;
} else {
@@ -390,7 +390,7 @@ class CustomData implements ArrayAccess {
* @param integer $offset Offset
* @return void
*/
- public function offsetUnset($offset) {
+ public function offsetUnset($offset):void {
unset($this->container[$offset]);
}
@@ -400,7 +400,7 @@ class CustomData implements ArrayAccess {
* @param $value Custom property value
* @return void
*/
- public function addCustomProperty($key, $value) {
+ public function addCustomProperty($key, $value):void {
$this->container['custom_properties'][$key] = $value;
}
diff --git a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php
index ee22ac54..ea22a41f 100644
--- a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php
+++ b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/Event.php
@@ -322,7 +322,7 @@ class Event implements ArrayAccess {
* @param integer $offset Offset
* @return boolean
*/
- public function offsetExists($offset) {
+ public function offsetExists($offset):bool {
return isset($this->container[$offset]);
}
@@ -331,7 +331,7 @@ class Event implements ArrayAccess {
* @param integer $offset Offset
* @return mixed
*/
- public function offsetGet($offset) {
+ public function offsetGet($offset):mixed {
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
@@ -341,7 +341,7 @@ class Event implements ArrayAccess {
* @param mixed $value Value to be set
* @return void
*/
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value):void {
if (is_null($offset)) {
$this->container[] = $value;
} else {
@@ -354,7 +354,7 @@ class Event implements ArrayAccess {
* @param integer $offset Offset
* @return void
*/
- public function offsetUnset($offset) {
+ public function offsetUnset($offset):void {
unset($this->container[$offset]);
}
diff --git a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/EventRequest.php b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/EventRequest.php
index 34475133..20f290b6 100644
--- a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/EventRequest.php
+++ b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/EventRequest.php
@@ -409,7 +409,7 @@ class EventRequest implements ArrayAccess {
* @param integer $offset Offset
* @return boolean
*/
- public function offsetExists($offset) {
+ public function offsetExists($offset):bool {
return isset($this->container[$offset]);
}
@@ -418,7 +418,7 @@ class EventRequest implements ArrayAccess {
* @param integer $offset Offset
* @return mixed
*/
- public function offsetGet($offset) {
+ public function offsetGet($offset):mixed {
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
@@ -428,7 +428,7 @@ class EventRequest implements ArrayAccess {
* @param mixed $value Value to be set
* @return void
*/
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value):void {
if (is_null($offset)) {
$this->container[] = $value;
} else {
@@ -441,7 +441,7 @@ class EventRequest implements ArrayAccess {
* @param integer $offset Offset
* @return void
*/
- public function offsetUnset($offset) {
+ public function offsetUnset($offset):void {
unset($this->container[$offset]);
}
diff --git a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/UserData.php b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/UserData.php
index 84a0a69d..fa91f299 100644
--- a/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/UserData.php
+++ b/vendor/facebook/php-business-sdk/src/FacebookAds/Object/ServerSide/UserData.php
@@ -532,7 +532,7 @@ class UserData implements ArrayAccess {
* @param integer $offset Offset
* @return boolean
*/
- public function offsetExists($offset) {
+ public function offsetExists($offset):bool {
return isset($this->container[$offset]);
}
@@ -541,7 +541,7 @@ class UserData implements ArrayAccess {
* @param integer $offset Offset
* @return mixed
*/
- public function offsetGet($offset) {
+ public function offsetGet($offset):mixed {
return isset($this->container[$offset]) ? $this->container[$offset] : null;
}
@@ -551,7 +551,7 @@ class UserData implements ArrayAccess {
* @param mixed $value Value to be set
* @return void
*/
- public function offsetSet($offset, $value) {
+ public function offsetSet($offset, $value):void {
if (is_null($offset)) {
$this->container[] = $value;
} else {
@@ -564,7 +564,7 @@ class UserData implements ArrayAccess {
* @param integer $offset Offset
* @return void
*/
- public function offsetUnset($offset) {
+ public function offsetUnset($offset):void {
unset($this->container[$offset]);
}
@henkvalk
Copy link
Author

henkvalk commented Dec 30, 2022

How to install this patch

  • Install a composer patcher

vaimo

composer require vaimo/composer-patches

or cweagans

composer require cweagans/composer-patches
  • inside your composer.json add to extra section:
"extra": {
        "magento-force": "override",
        "patches-file": "composer.patches.json",
        "patches-search": "patches"
    },
  • create file in project root folder composer.patches.json:

inside this file you add all your patches:

{
    "patches": {
        "*": {
            "Update Facebook Business SDK to php8.1": {
                "source": "patches/facebooksdk/facebook-php-business-sdk-compatible-with-php81.patch"
            }
        }
    }
}
  • create a folder called patches inside the root of your project
mkdir patches

all the patch files you added to the above composer.patches.json file you can add inside this folder.

  • add the patch file to the folder
mkdir patches/facebooksdk
cd patches/facebooksdk
wget https://gist.githubusercontent.com/henkvalk/c224a6a25af38b1b1284b40a316451bc/raw/d35ddadd1cf3f26b5e1e72d1ed3f8900b33cf30e/facebook-php-business-sdk-compatible-with-php81.patch
cd -

composer install will remove the package and install the package with the patch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment