diff --git a/php/src/Google/Protobuf/Internal/GPBUtil.php b/php/src/Google/Protobuf/Internal/GPBUtil.php index 1900e71ccc..cd65d8b7d4 100644 --- a/php/src/Google/Protobuf/Internal/GPBUtil.php +++ b/php/src/Google/Protobuf/Internal/GPBUtil.php @@ -168,7 +168,7 @@ class GPBUtil public static function checkFloat(&$var) { if (is_float($var) || is_numeric($var)) { - $var = floatval($var); + $var = unpack("f", pack("f", $var))[1]; } else { throw new \Exception("Expect float."); }