From d15501122a0da6580578e1046abf96bd882547b6 Mon Sep 17 00:00:00 2001 From: Freddy Bisaso Date: Mon, 22 May 2023 06:10:39 -0700 Subject: [PATCH] Fix PHP null exception. Summary: Issue reported on the Wordpress forum. https://wordpress.org/support/topic/php-fatal-error-364/ PHP Fatal error: Uncaught TypeError: array_key_exists(): Argument #2 ($array) must be of type array, null given in /srv/htdocs/wp-content/plugins/official-facebook-pixel/core/FacebookWordpressOpenBridge.php:119 Reviewed By: vahidkay-meta Differential Revision: D46067579 fbshipit-source-id: 2fc19965631ed01042b58af931d6b975f7c19ce6 --- facebook-for-wordpress.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/facebook-for-wordpress.php b/facebook-for-wordpress.php index c4abc838..eccd83e6 100644 --- a/facebook-for-wordpress.php +++ b/facebook-for-wordpress.php @@ -93,7 +93,9 @@ public function handle_events_request(){ FacebookPluginConfig::OPEN_BRIDGE_PATH) && $_SERVER['REQUEST_METHOD'] == 'POST'){ $data = json_decode(file_get_contents('php://input'), true); - FacebookWordpressOpenBridge::getInstance()->handleOpenBridgeReq($data); + if (!is_null($data)) { + FacebookWordpressOpenBridge::getInstance()->handleOpenBridgeReq($data); + } exit(); } }