From 5cec5d9c07335150e8eae5abac53fba37b33285b Mon Sep 17 00:00:00 2001 From: Ahmad Saad Aldeen Date: Fri, 30 Sep 2016 20:49:53 +0200 Subject: [PATCH] Could not generate new Access token. Invalid response from server Passing null as length will not make mb_substr use it's default, instead it will interpret it as 0. $result = mb_substr($result, $responseHeaderSize, null, '8bit'); Instead use: $result = mb_substr($result, $responseHeaderSize, mb_strlen($result), '8bit'); --- lib/PayPal/Core/PayPalHttpConnection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/PayPal/Core/PayPalHttpConnection.php b/lib/PayPal/Core/PayPalHttpConnection.php index 2e144a2..970d0d8 100644 --- a/lib/PayPal/Core/PayPalHttpConnection.php +++ b/lib/PayPal/Core/PayPalHttpConnection.php @@ -152,7 +152,7 @@ class PayPalHttpConnection if (function_exists('mb_strlen')) { $responseHeaderSize = mb_strlen($result, '8bit') - curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD); $responseHeaders = mb_substr($result, 0, $responseHeaderSize, '8bit'); - $result = mb_substr($result, $responseHeaderSize, null, '8bit'); + $result = mb_substr($result, $responseHeaderSize, mb_strlen($result), '8bit'); } else { $responseHeaderSize = strlen($result) - curl_getinfo($ch, CURLINFO_SIZE_DOWNLOAD); $responseHeaders = substr($result, 0, $responseHeaderSize);