Issues

ZF-6532: Zend_Filter_LocalizedToNormalized return date array instead of integer

Issue Type: Bug Created: 2009-05-05T01:10:21.000+0000 Last Updated: 2009-06-10T07:47:24.000+0000 Status: Resolved Fix version(s): - 1.9.0 (31/Jul/09)

Reporter: Mario Gehnke (tector) Assignee: Thomas Weidner (thomas) Tags: - Zend_Filter

Related issues: Attachments:

Description

$filter = new Zend_Filter_LocalizedToNormalized(array('locale' => 'de','precision' => 0)); $val = $filter->filter( '1.000.000,00' );

$val should be 1000000 now, but is an array with date informations:

array ( [date_format] => dd.MM.yyyy, [locale] => de, [day] => 1, [month] => 000, [year] => 000 )

i posted that issue on zfforum.de: http://zfforum.de/showthread.php/?p=33370…

One answer is that it is possible that the 1.000.000,00 matches ISO-Dateformat on

line 101: Zend_Locale_Format::checkDateFormat($value, $this->_options)

Comments

Posted by Piotr Czachur (zimnyx) on 2009-05-19T03:18:10.000+0000

I've met similar problem while playing with locales and this filter.

<pre class="highlight">
$locale = new Zend_Locale(Zend_Locale::ZFDEFAULT);
Zend_Registry::set('Zend_Locale', $locale);
###
$form = new Zend_Form;
$form->addElement('text', 'amount');
$form->amount->addFilter('LocalizedToNormalized');

When value "1,2.4" is passed to input amount, following error occours: preg_match() expects parameter 2 to be string, array given [trunk/lib/Zend/Locale/Format.php:515]

Posted by Stephan Wentz (swentz) on 2009-05-20T01:50:15.000+0000

We have the same problem here - with an integer '10000'. Result is:

array ( [date_format] => dd.MM.yyyy, [locale] => de_DE, [day] => 10, [month] => 00, [year] => 0 )

This makes Zend_Filter_LocalizedToNormalized absolutely unusable for us.

Posted by Thomas Weidner (thomas) on 2009-06-10T07:47:10.000+0000

Fixed with r15980.

Note that the value 1,2.4 is no number and will be detected as date.

Reason: Inputs like 01.02.04 -> 1. february 2004 or shortened also 1.2.4

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts