fix: convert native PHP floats to single precision (#8187)

* fix: convert native PHP floats to single precision

* fix unpack
pull/8202/head
Brent Shaffer 4 years ago committed by GitHub
parent 7165c34606
commit 468bc193ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      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.");
}

Loading…
Cancel
Save