|
View:
New views
7 Messages
—
Rating Filter:
Alert me
|
|
|
Zend_Validate_Float locale problemI'm using Zend_Validate_Float to validate a form field, but I set the
PHP locale to pt_BR, when I input some value with no decimals, it works fine, but, if I put, like 20,52 it returns false. After making some tests I've found out that it's because Zend_Validate_Float uses strval, which considers the locale and replaces the decimal point. I'm not sure wheter that's a bug or not, if it is, where can I report it? Thanks -- Felipe Weckx <fweckx@...> MT4 Tecnologia |
|
|
Re: Zend_Validate_Float locale problemHi, This is not a bug, but rather a feature request. I'd suggest a new filter for this: Zend_Validate_Currency perhaps. Thomas W. will know more about this. Best, Andries Seutens http://andries.systray.be Felipe Weckx schreef: > I'm using Zend_Validate_Float to validate a form field, but I set the > PHP locale to pt_BR, when I input some value with no decimals, it > works fine, but, if I put, like 20,52 it returns false. After making > some tests I've found out that it's because Zend_Validate_Float uses > strval, which considers the locale and replaces the decimal point. I'm > not sure wheter that's a bug or not, if it is, where can I report it? > > Thanks > Gecontroleerd op virussen door de JOJO Secure Gateway. |
|
|
Re: Zend_Validate_Float locale problemNo... this has nothing to do with currency.
The problem is that when a locale other than 'en' is used, and you do a string conversion of the float value, you will always get the locale's string representation returned for all php functions. Within Zend_Locale I fixed those problems which allows to work with all locales independently of the locale set within php, but as Zend_Validate (which is core not i18n) does not rely on Zend_Locale it's not working with it and has to be fixed seperate or make it dependent with Zend_Locale_Format. There is already an issue for that http://framework.zend.com/issues/browse/ZF-1882 The problem is identical for Int and Float. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com ----- Original Message ----- From: "Andries Seutens" <andries.seutens@...> To: "Felipe Weckx" <fweckx@...> Cc: <fw-i18n@...>; "Thomas Weidner" <thomas.weidner@...> Sent: Thursday, January 31, 2008 1:41 PM Subject: Re: [fw-i18n] Zend_Validate_Float locale problem > > Hi, > > This is not a bug, but rather a feature request. I'd suggest a new > filter for this: > Zend_Validate_Currency perhaps. > > Thomas W. will know more about this. > > Best, > > Andries Seutens > http://andries.systray.be > > > > Felipe Weckx schreef: >> I'm using Zend_Validate_Float to validate a form field, but I set the >> PHP locale to pt_BR, when I input some value with no decimals, it >> works fine, but, if I put, like 20,52 it returns false. After making >> some tests I've found out that it's because Zend_Validate_Float uses >> strval, which considers the locale and replaces the decimal point. I'm >> not sure wheter that's a bug or not, if it is, where can I report it? >> >> Thanks >> > -------------------------------------------------------------------------------- > Gecontroleerd op virussen door de JOJO Secure Gateway. > |
|
|
Re: Zend_Validate_Float locale problemHi Thomas,
Thanks for the clarification :) Best, Andries Thomas Weidner schreef: > No... this has nothing to do with currency. > The problem is that when a locale other than 'en' is used, and you do a > string conversion of the float value, you will always get the locale's > string representation returned for all php functions. > > Within Zend_Locale I fixed those problems which allows to work with all > locales independently of the locale set within php, but as Zend_Validate > (which is core not i18n) does not rely on Zend_Locale it's not working > with it and has to be fixed seperate or make it dependent with > Zend_Locale_Format. > > There is already an issue for that > http://framework.zend.com/issues/browse/ZF-1882 > The problem is identical for Int and Float. > > Greetings > Thomas Weidner, I18N Team Leader > http://www.thomasweidner.com > > ----- Original Message ----- From: "Andries Seutens" > <andries.seutens@...> > To: "Felipe Weckx" <fweckx@...> > Cc: <fw-i18n@...>; "Thomas Weidner" <thomas.weidner@...> > Sent: Thursday, January 31, 2008 1:41 PM > Subject: Re: [fw-i18n] Zend_Validate_Float locale problem > > >> >> Hi, >> >> This is not a bug, but rather a feature request. I'd suggest a new >> filter for this: >> Zend_Validate_Currency perhaps. >> >> Thomas W. will know more about this. >> >> Best, >> >> Andries Seutens >> http://andries.systray.be >> >> >> >> Felipe Weckx schreef: >>> I'm using Zend_Validate_Float to validate a form field, but I set the >>> PHP locale to pt_BR, when I input some value with no decimals, it >>> works fine, but, if I put, like 20,52 it returns false. After making >>> some tests I've found out that it's because Zend_Validate_Float uses >>> strval, which considers the locale and replaces the decimal point. I'm >>> not sure wheter that's a bug or not, if it is, where can I report it? >>> >>> Thanks >>> >> > > > -------------------------------------------------------------------------------- > > > >> Gecontroleerd op virussen door de JOJO Secure Gateway. >> > > > |
|
|
|
|
|
Re: Zend_Validate_Float locale problemWhat if I want to filter a user supplied value into float that php
understands... ? Regards, Eric On Jan 31, 2008, at 1:30 PM, Thomas Weidner wrote: > You could use > Zend_Locale_Format::isFloat > or > Zend_Locale_Format::isInteger > if this fit's your needs for validation. > They are both locale-aware and can also check inputs from different > locale-strings. > > Also it would be good to know if they could be improved, because > until now > there were no responses to this one. > Could mean that it works without problems, or that no body know > them... I > expect second :-) > > Greetings > Thomas Weidner, I18N Team Leader > http://www.thomasweidner.com > > ----- Original Message ----- From: "Felipe Weckx" <fweckx@...> > To: "Thomas Weidner" <thomas.weidner@...> > Sent: Thursday, January 31, 2008 6:43 PM > Subject: Re: [fw-i18n] Zend_Validate_Float locale problem > > >> Ok, I'll just use my own validation for now. Sorry for posting in >> the wrong list. >> >> Thanks for the explanation, hope this gets fixed soon. >> >> >> Thomas Weidner escreveu: >>> No... this has nothing to do with currency. >>> The problem is that when a locale other than 'en' is used, and you >>> do a string conversion of the float value, you will always get the >>> locale's string representation returned for all php functions. >>> >>> Within Zend_Locale I fixed those problems which allows to work >>> with all locales independently of the locale set within php, but >>> as Zend_Validate (which is core not i18n) does not rely on >>> Zend_Locale it's not working with it and has to be fixed seperate >>> or make it dependent with Zend_Locale_Format. >>> >>> There is already an issue for that http://framework.zend.com/issues/browse/ZF-1882 >>> The problem is identical for Int and Float. >>> >>> Greetings >>> Thomas Weidner, I18N Team Leader >>> http://www.thomasweidner.com >>> >>> ----- Original Message ----- From: "Andries Seutens" <andries.seutens@... >>> > >>> To: "Felipe Weckx" <fweckx@...> >>> Cc: <fw-i18n@...>; "Thomas Weidner" <thomas.weidner@... >>> > >>> Sent: Thursday, January 31, 2008 1:41 PM >>> Subject: Re: [fw-i18n] Zend_Validate_Float locale problem >>> >>> >>>> >>>> Hi, >>>> >>>> This is not a bug, but rather a feature request. I'd suggest a new >>>> filter for this: >>>> Zend_Validate_Currency perhaps. >>>> >>>> Thomas W. will know more about this. >>>> >>>> Best, >>>> >>>> Andries Seutens >>>> http://andries.systray.be >>>> >>>> >>>> >>>> Felipe Weckx schreef: >>>>> I'm using Zend_Validate_Float to validate a form field, but I >>>>> set the >>>>> PHP locale to pt_BR, when I input some value with no decimals, it >>>>> works fine, but, if I put, like 20,52 it returns false. After >>>>> making >>>>> some tests I've found out that it's because Zend_Validate_Float >>>>> uses >>>>> strval, which considers the locale and replaces the decimal >>>>> point. I'm >>>>> not sure wheter that's a bug or not, if it is, where can I >>>>> report it? >>>>> >>>>> Thanks >>>>> >>>> >>> >>> >>> -------------------------------------------------------------------------------- >>> >>> >>> >>>> Gecontroleerd op virussen door de JOJO Secure Gateway. >>>> >>> >>> >>> >> >> -- >> Felipe Weckx <fweckx@...> >> MT4 Tecnologia >> (11) 3064-3226 > |
|
|
Re: Zend_Validate_Float locale problemSame problem....
Zend_Filter is not locale-aware, has no workaround and does not use Zend_Locale. You would have to do the same as Felipe und extend/write your own filter/validator with Zend_Locale or do it yourself. I don't know if such an issue exists for Zend_Filter... if not feel free to open one. Greetings Thomas Weidner, I18N Team Leader http://www.thomasweidner.com ----- Original Message ----- From: "Eric Coleman" <eric@...> To: <fw-i18n@...> Sent: Thursday, January 31, 2008 7:37 PM Subject: Re: [fw-i18n] Zend_Validate_Float locale problem > What if I want to filter a user supplied value into float that php > understands... ? > > Regards, > Eric > > > On Jan 31, 2008, at 1:30 PM, Thomas Weidner wrote: > >> You could use >> Zend_Locale_Format::isFloat >> or >> Zend_Locale_Format::isInteger >> if this fit's your needs for validation. >> They are both locale-aware and can also check inputs from different >> locale-strings. >> >> Also it would be good to know if they could be improved, because until >> now >> there were no responses to this one. >> Could mean that it works without problems, or that no body know them... >> I >> expect second :-) >> >> Greetings >> Thomas Weidner, I18N Team Leader >> http://www.thomasweidner.com >> >> ----- Original Message ----- From: "Felipe Weckx" <fweckx@...> >> To: "Thomas Weidner" <thomas.weidner@...> >> Sent: Thursday, January 31, 2008 6:43 PM >> Subject: Re: [fw-i18n] Zend_Validate_Float locale problem >> >> >>> Ok, I'll just use my own validation for now. Sorry for posting in the >>> wrong list. >>> >>> Thanks for the explanation, hope this gets fixed soon. >>> >>> >>> Thomas Weidner escreveu: >>>> No... this has nothing to do with currency. >>>> The problem is that when a locale other than 'en' is used, and you do >>>> a string conversion of the float value, you will always get the >>>> locale's string representation returned for all php functions. >>>> >>>> Within Zend_Locale I fixed those problems which allows to work with >>>> all locales independently of the locale set within php, but as >>>> Zend_Validate (which is core not i18n) does not rely on Zend_Locale >>>> it's not working with it and has to be fixed seperate or make it >>>> dependent with Zend_Locale_Format. >>>> >>>> There is already an issue for that >>>> http://framework.zend.com/issues/browse/ZF-1882 >>>> The problem is identical for Int and Float. >>>> >>>> Greetings >>>> Thomas Weidner, I18N Team Leader >>>> http://www.thomasweidner.com >>>> >>>> ----- Original Message ----- From: "Andries Seutens" >>>> <andries.seutens@... >>>> > >>>> To: "Felipe Weckx" <fweckx@...> >>>> Cc: <fw-i18n@...>; "Thomas Weidner" <thomas.weidner@... >>>> > >>>> Sent: Thursday, January 31, 2008 1:41 PM >>>> Subject: Re: [fw-i18n] Zend_Validate_Float locale problem >>>> >>>> >>>>> >>>>> Hi, >>>>> >>>>> This is not a bug, but rather a feature request. I'd suggest a new >>>>> filter for this: >>>>> Zend_Validate_Currency perhaps. >>>>> >>>>> Thomas W. will know more about this. >>>>> >>>>> Best, >>>>> >>>>> Andries Seutens >>>>> http://andries.systray.be >>>>> >>>>> >>>>> >>>>> Felipe Weckx schreef: >>>>>> I'm using Zend_Validate_Float to validate a form field, but I set >>>>>> the >>>>>> PHP locale to pt_BR, when I input some value with no decimals, it >>>>>> works fine, but, if I put, like 20,52 it returns false. After making >>>>>> some tests I've found out that it's because Zend_Validate_Float uses >>>>>> strval, which considers the locale and replaces the decimal point. >>>>>> I'm >>>>>> not sure wheter that's a bug or not, if it is, where can I report >>>>>> it? >>>>>> >>>>>> Thanks >>>>>> >>>>> >>>> >>>> >>>> -------------------------------------------------------------------------------- >>>> >>>> >>>> >>>>> Gecontroleerd op virussen door de JOJO Secure Gateway. >>>>> >>>> >>>> >>>> >>> >>> -- >>> Felipe Weckx <fweckx@...> >>> MT4 Tecnologia >>> (11) 3064-3226 >> |
| Free Forum Powered by Nabble | Forum Help |