Summary | Problem with using and saving Gmap event |
Queue | Horde Framework Packages |
Queue Version | Git master |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | jan (at) horde (dot) org |
Requester | adominguez (at) cne (dot) gob (dot) ve |
Created | 07/22/2011 (5093 days ago) |
Due | |
Updated | 07/27/2011 (5088 days ago) |
Assigned | 07/22/2011 (5093 days ago) |
Resolved | 07/24/2011 (5091 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
Return correctly formatted float from there too (
Bug #10371).1 files changed, 1 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/b6b045a1f7a684cbb9579f8749d8d3c0bbce582b
because you need to change the another option when the value could be
a float, so on line 183, you have to change from:
elseif ($type == 'float') {
return (float)$value;
}
To:
elseif ($type == 'float') {
return sprintf('%F',(float)$value);
}
State ⇒ Resolved
Queue ⇒ Horde Framework Packages
Priority ⇒ 2. Medium
[jan] Correctly format float values independently from the current
locale (
Bug #10371).6 files changed, 53 insertions(+), 3 deletions(-)
http://git.horde.org/horde-git/-/commit/e7fff769954491f03a336f91239c8067482e6b1f
recognize it as float, so the casting it doesn't fix it.
What I do to to fix it is use the PHP function ?number_format? as
$params = array(number_format($point['lat'], 13, '.', ''),
number_format($point['lon'], 13, '.', ''), $point['zoom'], $event_id);
So the problem fix, but my mayor question is about the 'complete' use
of float data type on HORDE framework, what happen is project use that
data type?, will it fail in another Environment Locale?
State ⇒ Feedback
$params = array((float)$point['lat'], (float)$point['lon'],
$point['zoom'], $event_id);
Milestone ⇒
State ⇒ Unconfirmed
Patch ⇒ No
Queue ⇒ Kronolith
Summary ⇒ Problem with using and saving Gmap event
Type ⇒ Bug
Priority ⇒ 3. High
on function ?public function setLocation($event_id, $point)? (line 28)
and that because the function print the float (to ?event_lat? an
?event_lon? for the SQL query) number with ?,? as decimal separator
instead of ?.?
I discovered that it's related with the php Environment Locale and the
way as PHP converts a float to a strings, that's because PHP use that
environment, if you have a script with:
<?php
$v= 5.3;
echo ($v);
?>
You ?ALWAYS? expect that the result will be '5.3', but that's ONLY
true if you have 'setlocale(LC_ALL,'en_US.UTF-8' ); ', but if you are
using the Spanish translation, Horde change that locale to
'setlocale(LC_ALL,'es_ES.UTF-8' ); ' so the script's result will be
'5,3'
So or the Horde framework is bad and miss a configuration to print
float number into SQL or 'Kronolith' must adapt the string format of
the float number in order to to do the SQL query.