|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
alchemyx Smarty Rookie
Joined: 19 Feb 2004 Posts: 8 Location: Swinoujscie, Poland
|
Posted: Fri Oct 01, 2004 7:04 pm Post subject: Wrong locale interpretation |
|
|
Hello!
In polish language comma is used to separate fractions from the rest. So we write 25,5 and it means twenty five and a half.
It is fine, when it is used when displaying data, but when doing internal things everything should be written using dot. So 25.5 not 25,5.
And now funny thing:
- on glibc 2.2.5 with full locale issuing 70*2.2 returns 140 and 70*"2,2" returns 154 (with locale set to pl_PL)
- on glibc 2.2.5 with removed polish locale 70*2.2 returns 154 as required
- on glibc 2.3.3 with full locale issuing 70*2.2 returns 154 as required.
So I am afraid it is Smarty bug, because doing those calculations under PHP does no harm with any locale set or unset. The bug also appears when you try to embed PHP code with {php} {/php}
Any ideas? |
|
Back to top |
|
boots Administrator
Joined: 16 Apr 2003 Posts: 5611 Location: Toronto, Canada
|
Posted: Fri Oct 01, 2004 7:27 pm Post subject: |
|
|
Hi alchemyx.
What are you trying to do with Smarty that isn't working? Do you have examples?
FYI: Smarty's in-template math does not observe locale settings as-far-as-I-know -- and I don't expect it to either. |
|
Back to top |
|
alchemyx Smarty Rookie
Joined: 19 Feb 2004 Posts: 8 Location: Swinoujscie, Poland
|
Posted: Fri Oct 01, 2004 9:15 pm Post subject: |
|
|
Simple sample (what a name!):
{assign var=a value=70}
{assign var=b value=2.2}
{$a*$b}
Output shows: 140 instead of 154.
{assign var=a value=70}
{assign var=b value="2,2"}
{$a*$b}
Output shows 154.
It happens when I have setlocale(LC_ALL, "pl_PL"); in PHP. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
|
Back to top |
|
alchemyx Smarty Rookie
Joined: 19 Feb 2004 Posts: 8 Location: Swinoujscie, Poland
|
Posted: Sat Oct 02, 2004 8:39 am Post subject: |
|
|
It shows up in funny way . But OK, if it is PHP problem can you tell me in which version it was fixed? According to that bug tracker it was fixed in 4.3.0 and found again. |
|
Back to top |
|
messju Administrator
Joined: 16 Apr 2003 Posts: 3336 Location: Oldenburg, Germany
|
Posted: Sat Oct 02, 2004 9:53 am Post subject: |
|
|
dunno. i had the following phps at hand for testing
4.0.6 (buggy)
4.1.2 (buggy)
4.2.3 (buggy)
4.3.4 (ok)
4.3.5 (ok)
4.3.6 (ok)
4.3.7 (ok)
4.3.9 (ok) |
|
Back to top |
|
alchemyx Smarty Rookie
Joined: 19 Feb 2004 Posts: 8 Location: Swinoujscie, Poland
|
Posted: Sat Oct 02, 2004 4:21 pm Post subject: |
|
|
OK. It is enough for me, I will make upgrade of PHP. Thanks! |
|
Back to top |
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|