From f8c3e5f348ebd61023964d43c380bfce4630c8ef Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Thu, 19 Aug 2010 20:41:04 -0400 Subject: [PATCH] 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 --- framework/Image/lib/Horde/Image/Exif/Base.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) 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; } -- 2.11.0