From a024a46b4814e8347c63f57c067a5eded2eed8fc Mon Sep 17 00:00:00 2001 From: Marek Isalski Date: Mon, 11 Sep 2017 05:39:18 +0100 Subject: [PATCH] fix runtime in older versions of PHP caused by json_last_error_msg --- fulcrm_webhook.module | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fulcrm_webhook.module b/fulcrm_webhook.module index 0a976ae..7cebe7c 100644 --- a/fulcrm_webhook.module +++ b/fulcrm_webhook.module @@ -151,7 +151,10 @@ function fulcrm_webhook_webhook( $uuid ) { if ( array_key_exists( 'Content-Type', $headers ) && ( $headers[ 'Content-Type' ] === 'application/json' ) ) { $payload = json_decode( file_get_contents( "php://input" ), $assoc = TRUE ); $payload_error = json_last_error(); - $payload_error_msg = json_last_error_msg(); + if ( function_exists( 'json_last_error_msg' ) ) + $payload_error_msg = json_last_error_msg(); + else + $payload_error_msg = 'JSON error unavailable'; } else { $payload_error_msg = 'no payload'; }