Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zend_Session Exceptions after migration from 1.18.3 to 1.18.9 #125

Closed
richardsalvaia opened this issue Dec 22, 2020 · 2 comments
Closed

Comments

@richardsalvaia
Copy link

I have updated the lastest version of zf1-future (1.18.9) into my production server running (PHP 7.4.13) and my error tracking begins to report a lot of session errors, some errors are difficult to reproduce, but in several requests I receive a lot of them, I investigated other causes, but the erros only stopped after I downgrade to 1.18.3. Bellow I list some of these errors, one of a login page, and another of a Zend_Captcha form. Some errors I able to reproduce, others my clients advice me.

Message:
The session has already been started. The session id must be set first.

Stack trace:
#0 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Session.php(436): Zend_Session::setId('63041a5e48e115c...')
#1 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)
#2 /home/cms2rs/www/application/classes/CmsAuth.php(9): Zend_Session_Namespace->__construct('Cms_Auth')
#3 /home/cms2rs/www/application/cms/controllers/AuthController.php(20): Class_CmsAuth->__construct()
#4 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Controller/Action.php(516): Cms_AuthController->loginAction()
#5 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('loginAction')
#6 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#7 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Application/Bootstrap/Bootstrap.php(105): Zend_Controller_Front->dispatch()
#8 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Application.php(384): Zend_Application_Bootstrap_Bootstrap->run()
#9 /home/cms2rs/www/public/index.php(74): Zend_Application->run()

Message:
Exception caught by form: The session has already been started. The session id must be set first.

Stack trace:
#0 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Session.php(436): Zend_Session::setId('0ba6a0be45e7ba3...')
#1 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Session/Namespace.php(143): Zend_Session::start(true)
#2 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Captcha/Word.php(270): Zend_Session_Namespace->__construct('Zend_Form_Captc...')
#3 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Captcha/Word.php(314): Zend_Captcha_Word->getSession()
#4 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Captcha/Word.php(361): Zend_Captcha_Word->_setWord('c7p2')
#5 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Captcha/Image.php(438): Zend_Captcha_Word->generate()
#6 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Form/Element/Captcha.php(188): Zend_Captcha_Image->generate()
#7 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Form/Decorator/FormElements.php(116): Zend_Form_Element_Captcha->render()
#8 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Form.php(2993): Zend_Form_Decorator_FormElements->render('')
#9 /home/cms2rs/www/vendor/shardj/zf1-future/library/Zend/Form.php(3009): Zend_Form->render()
#10 /home/cms2rs/www/public/layouts/site/veiculos/custom_views/proposta/form.phtml(3): Zend_Form->__toString()

@richardsalvaia
Copy link
Author

After investigate I concluse that one of my cpanels servers hads a php.ini configuration wrong and using a parameter in PHP 7.4 config that is not supported in 7.2+.

Cause of this parameter in php.ini the error occurred: hash_bits_per character (this parameter is not to exists in this PHP version 7.4).

The validation of this could even be changed, first checking the PHP version and if it is 7.2+, use the parameter sid_bits_per_character otherwise validate by hash_bits_per_character.

@Shardj
Copy link
Owner

Shardj commented Jan 13, 2021

Feel free to make a PR if you want to make that change, I'm glad you found the problem that was stopping you

@Shardj Shardj closed this as completed Jan 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants