PHP new build fix for TBinaryProtocol
Reviewed By: shire
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665079 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/php/src/protocol/TBinaryProtocol.php b/lib/php/src/protocol/TBinaryProtocol.php
index 9aa3083..962fcfe 100644
--- a/lib/php/src/protocol/TBinaryProtocol.php
+++ b/lib/php/src/protocol/TBinaryProtocol.php
@@ -309,13 +309,19 @@
}
} else {
+ // Upcast negatives in LSB bit
+ if ($arr[2] & 0x80000000) {
+ $arr[2] = $arr[2] & 0xffffffff;
+ }
+
// Check for a negative
if ($arr[1] & 0x80000000) {
- $arr[1] = $arr[1] ^ 0xFFFFFFFF;
- $arr[2] = $arr[2] ^ 0xFFFFFFFF;
- $value = 0 - $arr[1]*4294967296 - $arr[2] - 1;
+ $arr[1] = $arr[1] & 0xffffffff;
+ $arr[1] = $arr[1] ^ 0xffffffff;
+ $arr[2] = $arr[2] ^ 0xffffffff;
+ $value = 0 - $arr[1]*4294967296 - $arr[2] - 1;
} else {
- $value = $arr[1]*4294967296 + $arr[2];
+ $value = $arr[1]*4294967296 + $arr[2];
}
}