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
Symfony 2.3 RC1 and PdoSessionHandler #8095
Comments
re #7634 |
@t3chn0r The fix is easy: configure your PDO instance to use exceptions, as described in the error message |
@stof, but where exactly do I configure PDO? Right now the only code I have in my project related to PDO is the following lines in config.yml:
So, do I need to modify this component directly under the vendor directory? |
you are doing it in your service definition: services:
pdo:
class: PDO
arguments:
- "mysql:host=%database_host%;port=%database_port%;dbname=%database_name%"
- '%database_user%'
- '%database_password%'
calls:
- [setAttribute, [3, 2]] # \PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION |
Perfect! Thanks a lot! I think the documentation in "The Book" should definitely add that for 2.3... ;) |
Please open an issue on the symfony-docs repo (or even better a PR). And it is also true for older version btw (except it was not checking if you were messing its error handling or no). I'm closing this ticket as there is no issue in the code |
t3chn0r commentedMay 19, 2013
I just upgraded my project to 2.3.RC1 and now I'm getting this error, not sure if there's something new that I need to do now on my side or if there's something missing with the implementation of PdoSessionHandler:
_Fatal error: Uncaught exception 'InvalidArgumentException' with message '"Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler" requires PDO error mode attribute be set to throw Exceptions (i.e. $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION))' in /var/www/symfony23/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php:52 Stack trace: #0 /var/www/symfony23/app/cache/dev/appDevDebugProjectContainer.php(2545): Symfony\Component\HttpFoundation\Session\Storage\Handler\PdoSessionHandler->_construct(Object(PDO), Array) #1 /var/www/symfony23/app/bootstrap.php.cache(152): appDevDebugProjectContainer->getSession_Handler_PdoService() #2 /var/www/symfony23/app/cache/dev/appDevDebugProjectContainer.php(2571): Symfony\Component\DependencyInjection\Container->get('session.handler...') #3 /var/www/symfony23/app/bootstrap.php.cache(152): appDevDebugProjectContainer->getSession_Storage_NativeService() #4 /var/www/symfony23/app/cache/dev/ap in /var/www/symfony23/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php on line 52
Regards
The text was updated successfully, but these errors were encountered: