6.0.0-alpha14
7/1/25

[#10371] Problem with using and saving Gmap event
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

History
07/27/2011 09:39:44 AM Git Commit Comment #6 Reply to this comment
Changes have been made in Git for this ticket:

Return correctly formatted float from there too (Bug #10371).

  1 files changed, 1 insertions(+), 1 deletions(-)
http://git.horde.org/horde-git/-/commit/b6b045a1f7a684cbb9579f8749d8d3c0bbce582b
07/25/2011 06:45:57 PM adominguez (at) cne (dot) gob (dot) ve Comment #5 Reply to this comment
Thank for the bug's correction, but I'm afraid that it are incomplete 
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);
}
07/24/2011 05:32:43 PM Jan Schneider Assigned to Jan Schneider
State ⇒ Resolved
 
07/24/2011 05:31:28 PM Jan Schneider Version ⇒ Git master
Queue ⇒ Horde Framework Packages
Priority ⇒ 2. Medium
 
07/24/2011 05:31:18 PM Git Commit Comment #4 Reply to this comment
Changes have been made in Git for this ticket:

[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
07/22/2011 09:33:50 PM adominguez (at) cne (dot) gob (dot) ve Comment #3 Reply to this comment
Not, because the problem is not the PHP data type, PHP ALWAYS 
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?
07/22/2011 09:18:18 PM Michael Rubinsky Comment #2
State ⇒ Feedback
Reply to this comment
Does casting the values to (float) prior to the query fix it? i.e.,

  $params = array((float)$point['lat'], (float)$point['lon'], 
$point['zoom'], $event_id);

07/22/2011 06:30:29 PM adominguez (at) cne (dot) gob (dot) ve Comment #1
Milestone ⇒
State ⇒ Unconfirmed
Patch ⇒ No
Queue ⇒ Kronolith
Summary ⇒ Problem with using and saving Gmap event
Type ⇒ Bug
Priority ⇒ 3. High
Reply to this comment
Hi, there is a problem at the file ?horde/kronolith/lib/Geo/Sql.php? 
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.

Saved Queries