ZF-10714: Form validation (Zend_Form_Element_Hash) in Google Chrome
Description
Hello, i have a problem with element Zend_Form_Element_Hash. In Google Chrome (7) form validation report me a error : "No token was provided to match against", but in FF or IE it works fine.
Comments
Posted by Ryan Mauger (bittarman) on 2010-11-19T07:14:25.000+0000
Could you provide some more information about how to reproduce this error?
I use chrome daily for my development work, and have never had this issue.
If this is a support question, could you direct it to the fw-general mailing list, or to #zftalk on freenode IRC
Posted by Dennis Winter (denniswinter) on 2010-11-19T07:30:10.000+0000
I don't think, this is an issue of ZF! I've had this and other problems in the past with Google Chrome. This browser caches so freakin' hard, that it comes to such errors in development! Please delete all your internet data in chrome and restart at least your browser (if not the whole OS). That should normally do the job!
Posted by Kim Blomqvist (kblomqvist) on 2010-11-19T10:33:18.000+0000
Added issues I think are related to this issue.
Posted by Kim Blomqvist (kblomqvist) on 2010-12-10T00:51:57.000+0000
The same issue haunted me in the beginning of the week. However, in my case I had two forms in the site: Feedback and Order. Both of these forms had hash element. In the latest version of Firefox, Feedback form worked but Order form didn't. In Chrome and IE both forms worked. I was unable to track the problem and it seems to be very hard to isolate. The only solution atm. was to remove the hash element from the Order form.
I have had similar problems in ZF-5182, but at this time neither of these forms were placed at the landing page (the first page of the site).
Posted by Max Gordon (mgordon) on 2011-01-21T14:40:19.000+0000
I've had the same problem with the Chrome browser. The issue is not really a bug in ZF but in redirects, in my case the Zend_Auth/Acl code. When Chrome looks for pages to cache and is redirected to the current page the hash fails to validate.
In my code I've found that when I have a redirect to a form, usually the case with login forms I get the token error, I've now changed the redirect to an login error in the ErrorController and that seems to work better.
Below is some scaled down code that I've used when debugging this issue if you want to try it out yourselves:
If you want to see the error when logging in use:
Posted by Adam Lundrigan (adamlundrigan) on 2012-03-13T19:18:21.000+0000
Does this problem still persist? If so, is it with the framework or the browser? A lot of these wishy-washy Zend_Session-related bugs appear to be falling into the "concurrent requests returning 404 errors cause competing sessions to be initiated" issue (primarily with Google Chrome)
Posted by Patrick McMahon (technoicon) on 2012-04-24T07:50:20.000+0000
I've having the same issue. In chrome, if I wait over 5 mins. i get "No Token was provided to match against" I can submit again and it works. If i submit the form straight after loading the page it works fine.
Posted by Patrick McMahon (technoicon) on 2012-04-24T07:52:20.000+0000
with IE. no need to wait, just get this error: "The two given tokens do not match" after submitting twice it works.
Posted by Patrick McMahon (technoicon) on 2012-05-02T04:26:40.000+0000
I set the TTL. via timeout. I did this and it worked for chrome and IE:
$this->addElement('hash', 'csrf', array( 'ignore' => true, 'timeout' => 60000, ));