From: Michael J. Rubinsky Date: Fri, 20 Aug 2010 00:41:04 +0000 (-0400) Subject: Don't perform any string operations on the variable when we assume it's the decimal... X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=f8c3e5f348ebd61023964d43c380bfce4630c8ef;p=horde.git Don't perform any string operations on the variable when we assume it's the decimal value. Just cast it outright, don't trim() or replace the ordinal indicators if present, the cast operation will do that for us, and as a bonus, won't corrupt the value if it's in a locale that doesn't use a decimal point for a decimal seperator. Bug: 9180 --- diff --git a/framework/Image/lib/Horde/Image/Exif/Base.php b/framework/Image/lib/Horde/Image/Exif/Base.php index 6180c4522..8a13cd2b2 100644 --- a/framework/Image/lib/Horde/Image/Exif/Base.php +++ b/framework/Image/lib/Horde/Image/Exif/Base.php @@ -103,12 +103,11 @@ abstract class Horde_Image_Exif_Base // According to EXIF standard, GPS data can be in the form of // dd/1 mm/1 ss/1 or as a decimal reprentation. if (!is_array($data)) { - // Assume a scalar is a decimal representation - but strip it of - // any stray characters that may be there. - return (double)trim(str_replace(array('N', 'S', 'E', 'W'), - array('', '', '', ''), - $data)); + // Assume a scalar is a decimal representation. Cast it to a float + // which will get rid of any stray ordinal indicators. (N, S, etc...) + return (double)$data; } + if ($data[0] == 0) { return 0; }