Error on date validation #4619
Comments
I have same issue, without settings filters (so it use natives filter provided by the element)
|
@claudiasagner @Gounlaf Can you please update the status of this issue? I am unable to replicate this with the following unit test
It appears to me this issue has already been resolved. |
Hi @steverhoades, the problem is still here for me ;
In the view
Maybe a missconfig ? I'm on OS-X, using Mamp (PHP 5.4.19) ; |
@Gounlaf can you take a look at the unit test I am running and help me reproduce the issue you are describing? I've run that test on 2.2.5 and it still passed. |
@steverhoades I will try to Edit : i think i tell you something wrong >< ; the error "Invalid date string provided..." is no more here ; but my form is validated I setted a InputFilter on the form
With this, the form is validated ; |
@Gounlaf I see my error, I was testing the date validator, not the date filter. Looking at the exception triggered above, that seems to be the proper behavior (based on design). Running the following test:
returns the following unit test output:
That is inline with an existing test checking for invalid arguments. This was tested on 2.2.5 - It would appear to me that you need to put your code in a try block and listen for the Zend\Filter\Exception\InvalidArgumentException. To see the line triggering this exception see: Updating that test to follow the one preceeding it results in passed unit test
|
Hi @steverhoades, The problem was else where : i don't use InputFilters correctly =/ I thank Form::setInputFilter() method was merging the "default input specifications" with the one provided (calling attachInputFilterDefaults), but it's not the case (https://gist.github.com/Gounlaf/9204709) ; any idea were I'm wrong ? |
This issue has been closed as part of the bug migration program as outlined here - http://framework.zend.com/blog/2016-04-11-issue-closures.html |
I'm not sure if #4592 has the same cause.
I got an error when validating a wrong date in a date field.
Code:
Error:
Code: 0
File: Zend_Framework_2_2/Zend/Filter/DateTimeFormatter.php
Line: 60
Message: Invalid date string provided
Trace: 0 Zend_Framework_2_2/Zend/Filter/AbstractFilter.php(85): Zend\Filter\DateTimeFormatter->filter('fffffff')
1 [internal function]: Zend\Filter\AbstractFilter->__invoke('fffffff')
2 Zend_Framework_2_2/Zend/Filter/FilterChain.php(218): call_user_func(Object(Zend\Filter\DateTimeFormatte r), 'fffffff')
3 Zend_Framework_2_2/Zend/InputFilter/Input.php(262): Zend\Filter\FilterChain->filter('fffffff')
4 Zend_Framework_2_2/Zend/InputFilter/Input.php(307): Zend\InputFilter\Input->getValue()
5 Zend_Framework_2_2/Zend/InputFilter/BaseInputFilter.php(296): Zend\InputFilter\Input->isValid(Array)
6 Zend_Framework_2_2/Zend/InputFilter/BaseInputFilter.php(167): Zend\InputFilter\BaseInputFilter->validateInputs(Array)
7 Zend_Framework_2_2/Zend/Form/Form.php(476): Zend\InputFilter\BaseInputFilter->isValid()
8 myapp/module/Test/src/Test/Controller/TestController.php(479): Zend\Form\Form->isValid()
9 Zend_Framework_2_2/Zend/Mvc/Controller/AbstractActionController.php(83): Test\Controller\TestController->testAction()
10 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
11 Zend_Framework_2_2/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
12 Zend_Framework_2_2/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
13 Zend_Framework_2_2/Zend/Mvc/Controller/AbstractController.php(117): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
14 Zend_Framework_2_2/Zend/Mvc/DispatchListener.php(114): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request) , Object(Zend\Http\PhpEnvironment\Response))
15 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
16 Zend_Framework_2_2/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
17 Zend_Framework_2_2/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
18 Zend_Framework_2_2/Zend/Mvc/Application.php(309): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
19 myapp/public/index.php(14): Zend\Mvc\Application->run()
20 {main}
previous
Code: 0
File: Zend_Framework_2_2/Zend/Filter/DateTimeFormatter.php
Line: 79
Message: DateTime::__construct(): Failed to parse time string (fffffff) at position 0 (f): The timezone could not be found in the database
Trace: 0 Zend_Framework_2_2/Zend/Filter/DateTimeFormatter.php(79): DateTime->__construct('fffffff')
1 Zend_Framework_2_2/Zend/Filter/DateTimeFormatter.php(57): Zend\Filter\DateTimeFormatter->normalizeDateTime('fffffff')
2 Zend_Framework_2_2/Zend/Filter/AbstractFilter.php(85): Zend\Filter\DateTimeFormatter->filter('fffffff')
3 [internal function]: Zend\Filter\AbstractFilter->__invoke('fffffff')
4 Zend_Framework_2_2/Zend/Filter/FilterChain.php(218): call_user_func(Object(Zend\Filter\DateTimeFormatte r), 'fffffff')
5 Zend_Framework_2_2/Zend/InputFilter/Input.php(262): Zend\Filter\FilterChain->filter('fffffff')
6 Zend_Framework_2_2/Zend/InputFilter/Input.php(307): Zend\InputFilter\Input->getValue()
7 Zend_Framework_2_2/Zend/InputFilter/BaseInputFilter.php(296): Zend\InputFilter\Input->isValid(Array)
8 Zend_Framework_2_2/Zend/InputFilter/BaseInputFilter.php(167): Zend\InputFilter\BaseInputFilter->validateInputs(Array)
9 Zend_Framework_2_2/Zend/Form/Form.php(476): Zend\InputFilter\BaseInputFilter->isValid()
10 myapp/module/Test/src/Test/Controller/TestController.php(479): Zend\Form\Form->isValid()
11 Zend_Framework_2_2/Zend/Mvc/Controller/AbstractActionController.php(83): Test\Controller\TestController->addAction()
12 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
13 Zend_Framework_2_2/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
14 Zend_Framework_2_2/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
15 Zend_Framework_2_2/Zend/Mvc/Controller/AbstractController.php(117): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
16 Zend_Framework_2_2/Zend/Mvc/DispatchListener.php(114): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request) , Object(Zend\Http\PhpEnvironment\Response))
17 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
18 Zend_Framework_2_2/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
19 Zend_Framework_2_2/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
20 Zend_Framework_2_2/Zend/Mvc/Application.php(309): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
21 myapp/public/index.php(14): Zend\Mvc\Application->run()
22 {main}
The text was updated successfully, but these errors were encountered: