From 939203fcb188c0aadd73275bf9971d2d340cb813 Mon Sep 17 00:00:00 2001 From: Simon Date: Thu, 12 Apr 2018 10:31:26 +0200 Subject: [PATCH] Improved Performance of processResponse As bin2hex is a bit slow, only parse the start of the string --- src/WooCommerce/HttpClient/HttpClient.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WooCommerce/HttpClient/HttpClient.php b/src/WooCommerce/HttpClient/HttpClient.php index e69484b..614e346 100644 --- a/src/WooCommerce/HttpClient/HttpClient.php +++ b/src/WooCommerce/HttpClient/HttpClient.php @@ -363,7 +363,7 @@ protected function processResponse() { $body = $this->response->getBody(); - if (0 === strpos(bin2hex($body), 'efbbbf')) { + if (0 === strpos(bin2hex(substr($body, 0, 4)), 'efbbbf')) { $body = substr($body, 3); }