Thrift-1427: PHP library uses non-multibyte safe functions with mbstring function overloading
Client: php
Patch: Bryan Alves
Fixes issue with php overloaded mbstring to be binary-safe for strlen and substr.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1207960 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/php/src/transport/THttpClient.php b/lib/php/src/transport/THttpClient.php
index 880011a..118f0d3 100644
--- a/lib/php/src/transport/THttpClient.php
+++ b/lib/php/src/transport/THttpClient.php
@@ -85,7 +85,7 @@
* @param string $uri
*/
public function __construct($host, $port=80, $uri='', $scheme = 'http') {
- if ((strlen($uri) > 0) && ($uri{0} != '/')) {
+ if ((TStringFuncFactory::create()->strlen($uri) > 0) && ($uri{0} != '/')) {
$uri = '/'.$uri;
}
$this->scheme_ = $scheme;
@@ -175,7 +175,7 @@
'Accept: application/x-thrift',
'User-Agent: PHP/THttpClient',
'Content-Type: application/x-thrift',
- 'Content-Length: '.strlen($this->buf_));
+ 'Content-Length: '.TStringFuncFactory::create()->strlen($this->buf_));
$options = array('method' => 'POST',
'header' => implode("\r\n", $headers),