jonseg/crud-admin-generator

Session start error

Opened this issue · 1 comments

Hi,

I've just installed everything, generated the admin pages and the list pages display perfectly. When I click to EDIT, I get the error listed below. Any ideas why this should be, and why the first page should work and not the EDIT page?

RuntimeException in NativeSessionStorage.php line 131: Failed to start the session: already started by PHP.

in NativeSessionStorage.php line 131
at NativeSessionStorage->start() in Session.php line 71
at Session->start() in SessionTokenStorage.php line 92
at SessionTokenStorage->hasToken('form') in CsrfTokenManager.php line 54
at CsrfTokenManager->getToken('form') in FormTypeCsrfExtension.php line 109
at FormTypeCsrfExtension->finishView(object(FormView), object(Form), array('block_name' => null, 'disabled' => false, 'label' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'required' => true, 'read_only' => false, 'max_length' => null, 'pattern' => null, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'virtual' => null, 'compound' => true, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_provider' => object(CsrfTokenManager), 'intention' => null, 'error_mapping' => array(), 'cascade_validation' => false, 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'extra_fields_message' => 'This form should not contain extra fields.', 'attr' => array(), 'data' => array('cat_name' => 'Blowers', 'cat_show' => '1'), 'data_class' => null, 'empty_data' => object(Closure), 'error_bubbling' => true, 'label_attr' => array(), 'inherit_data' => false, 'csrf_token_manager' => object(CsrfTokenManager), 'csrf_token_id' => null, 'validation_groups' => null, 'constraints' => array())) in ResolvedFormType.php line 188
at ResolvedFormType->finishView(object(FormView), object(Form), array('block_name' => null, 'disabled' => false, 'label' => null, 'translation_domain' => null, 'auto_initialize' => true, 'trim' => true, 'required' => true, 'read_only' => false, 'max_length' => null, 'pattern' => null, 'property_path' => null, 'mapped' => true, 'by_reference' => true, 'virtual' => null, 'compound' => true, 'method' => 'POST', 'action' => '', 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.', 'csrf_protection' => true, 'csrf_field_name' => '_token', 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.', 'csrf_provider' => object(CsrfTokenManager), 'intention' => null, 'error_mapping' => array(), 'cascade_validation' => false, 'invalid_message' => 'This value is not valid.', 'invalid_message_parameters' => array(), 'extra_fields_message' => 'This form should not contain extra fields.', 'attr' => array(), 'data' => array('cat_name' => 'Blowers', 'cat_show' => '1'), 'data_class' => null, 'empty_data' => object(Closure), 'error_bubbling' => true, 'label_attr' => array(), 'inherit_data' => false, 'csrf_token_manager' => object(CsrfTokenManager), 'csrf_token_id' => null, 'validation_groups' => null, 'constraints' => array())) in Form.php line 1058
at Form->createView() in index.php line 277
at {closure}('1')
at call_user_func_array(object(Closure), array('1')) in HttpKernel.php line 145
at HttpKernel->handleRaw(object(Request), '1') in HttpKernel.php line 66
at HttpKernel->handle(object(Request), '1', true) in Application.php line 586
at Application->handle(object(Request)) in Application.php line 563
at Application->run() in base.php line 40
at require_once('/var/www/scrspares/admin/web/controllers/base.php') in index.php line 13

Hi !
I've found a solution that works for me !
Edit the file\vendor\symfony\security-csrf\TokenStorage\SessionTokenStorage.php
Replace every
if (!$this->session->isStarted())
by
if (!$this->session->isStarted() && session_status() === PHP_SESSION_NONE )