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/protocol/TCompactProtocol.php b/lib/php/src/protocol/TCompactProtocol.php
index 6ecbd09..9f0d407 100644
--- a/lib/php/src/protocol/TCompactProtocol.php
+++ b/lib/php/src/protocol/TCompactProtocol.php
@@ -121,7 +121,7 @@
public function writeVarint($data) {
$out = $this->getVarint($data);
- $result = strlen($out);
+ $result = TStringFuncFactory::create()->strlen($out);
$this->trans_->write($out, $result);
return $result;
}
@@ -308,7 +308,7 @@
}
public function writeString($value) {
- $len = strlen($value);
+ $len = TStringFuncFactory::create()->strlen($value);
$result = $this->writeVarint($len);
if ($len) {
$this->trans_->write($value, $len);
@@ -653,7 +653,7 @@
}
}
- $ret = strlen($out);
+ $ret = TStringFuncFactory::create()->strlen($out);
$this->trans_->write($out, $ret);
return $ret;