CaptchaBundle
CaptchaBundle copied to clipboard
"Code does not match" when using PHP built-in web server
Hi folks, I'm on this issue since 2 days and i'm really stuck! Here is the thing.
There is a simple "sign-up" form which use the captcha type.
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('email', 'email', [
'label' => 'all.email'
])
->add('plainPassword', 'repeated', [
'type' => 'password',
'invalid_message' => 'all.password_mismatch',
'first_options' => ['label' => 'all.password'],
'second_options' => ['label' => 'all.password_confirm']
])
->add('captcha', 'captcha')
->add('submit', 'submit', [
'label' => 'all.submit'
])
;
}
Using my Apache Web Server, everything is fine. When I type a bad captcha I got insulted, when I type a good one my account is created.
Using the PHP built-in web server app/console server:run
I always get insulted!
Using Apache, I've figured out the following workflow:
- A new captcha is generated
- The captcha is stored in the Session
- Form submission (the page is reloaded)
- The captcha is retrieve from the session (and is equal to the one stored on step 2.)
- The retrieved captcha is compared to the form input value
- Done
Using PHP Web Server:
- A new captcha is generated
- The captcha is stored in the Session
- Form submission (the page is reloaded)
- The captcha is retrieve from the session --> but this time different form the one stored on the step 2!!
- The retrieved captcha is compared to the form input value
- Done
Any ideas?
Thanks.
I already noticied that the session handling is a little bit erratic in the built-in server
What is your PHP version?
5.5.3