From 534a63bb7d5a73f24d422f64509c1460f4c3c17f Mon Sep 17 00:00:00 2001 From: lnn1123 Date: Tue, 10 May 2016 18:44:20 +0800 Subject: [PATCH] #fix CompactProtocol readI64 function, value=1461563457000 --- lib/php/lib/Thrift/Protocol/TCompactProtocol.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/php/lib/Thrift/Protocol/TCompactProtocol.php b/lib/php/lib/Thrift/Protocol/TCompactProtocol.php index 28703516c8b..ab12e1c129b 100644 --- a/lib/php/lib/Thrift/Protocol/TCompactProtocol.php +++ b/lib/php/lib/Thrift/Protocol/TCompactProtocol.php @@ -614,8 +614,8 @@ public function readI64(&$value) // Shift hi and lo together. if ($shift >= 32) { $hi |= (($byte & 0x7f) << ($shift - 32)); - } elseif ($shift > 25) { - $hi |= (($byte & 0x7f) >> ($shift - 25)); + } elseif ($shift > 24) { + $hi |= (($byte & 0x7f) >> ($shift - 24)); } if (($byte >> 7) === 0) { break; @@ -635,7 +635,7 @@ public function readI64(&$value) // Now put $hi and $lo back together if (true) { - $isNeg = $hi < 0; + $isNeg = $hi < 0 || $hi & 0x80000000; // Check for a negative if ($isNeg) {