Issue Type: Bug Created: 2010-01-24T12:07:07.000+0000 Last Updated: 2010-03-27T14:40:43.000+0000 Status: Resolved Fix version(s): - 1.10.3 (01/Apr/10)
Reporter: Thomas Weidner (thomas) Assignee: Thomas Weidner (thomas) Tags: - Zend_Validate
Related issues: Attachments:
When Zend_Validate_Float and Zend_Validate_Int are used without giving the locale parameter, then PHP's internals are used.
In detail floatval and strval. floatval is not dependend on the locale. The problem is now that when a user uses the following code:
<pre class="highlight"> setlocale(LC_ALL, 'de_AT'); $valid = Zend_Validate_Float(); $valid->isValid('1,3'); // -> false
Any user would expect that the validator now uses PHP's/the environments locale settings and the string 1,3 returns true.
In fact 1,3 is converted by floatval to 1 as floatval seems to support ONLY english notation.
In past Zend_Validate_Float used Zend_Locale also for PHP internal detections. But I was said to revert it due to "performance"-reasons. So the question is now:
Should we document this PHP bug and note that Zend_Validate_Float supports only english noted strings (and not solve this php bug), or should we force to use the localized detection (with performance degration) when a non-english string is detected (or the detection fails on english strings when no locale parameter has been set)?
Note that this works:
<pre class="highlight"> $valid = Zend_Validate_Float('de_AT'); $valid->isValid('1,3'); // -> true
Please give me a note how I have to solve this problem so it conforms ZF policy.
Posted by Thomas Weidner (thomas) on 2010-03-27T14:40:43.000+0000
Fixed with r21664
Have you found an issue?
See the Overview section for more details.