From ed0846da6f988981829f1bb4f0ff62211e6fdff8 Mon Sep 17 00:00:00 2001 From: Rekky Date: Wed, 30 Oct 2013 11:00:39 +0400 Subject: [PATCH] Fix byte length counting if strlen overloading is used --- src/BeSimple/SoapServer/SoapResponse.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/BeSimple/SoapServer/SoapResponse.php b/src/BeSimple/SoapServer/SoapResponse.php index e624fcb..01789b8 100644 --- a/src/BeSimple/SoapServer/SoapResponse.php +++ b/src/BeSimple/SoapServer/SoapResponse.php @@ -54,9 +54,16 @@ class SoapResponse extends CommonSoapResponse header('Content-Type: ' . $this->getContentType()); // get content to send $response = $this->getContent(); + // set Content-Length header - header('Content-Length: '. strlen($response)); + if (function_exists('mb_strlen')) { + $length = mb_strlen($response, '8bit'); + } else { + $length = strlen($response); + } + header('Content-Length: ' . $length); + // send response to client echo $response; } -} \ No newline at end of file +}