-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
CreateSavepoint method does not connect automatically to the database #3437
Comments
Would you be able to send in a test and a fix? Adding a |
Sure, I'll give it a go. What do you think should we also log SAVEPOINT related queries like here: dbal/lib/Doctrine/DBAL/Connection.php Lines 1249 to 1251 in 9b88bf3
|
That would make a lot of sense, yes |
@tezvi yes. It was detected by PHPStan as calling a method on a potentially null value. |
Nice, case closed then 😁 Example: dbal/lib/Doctrine/DBAL/Connection.php Line 1350 in 29c7ba6
|
@tezvi not sure what this is about. Is something not logged when it's supposed to be? Please feel free to file a new issue. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Bug Report
Summary
When executing createSavepoint method on Connection instance PHP halts with null reference exception. The connection was not previously established.
Current behaviour
When executing Doctrine\DBAL\Connection::createSavepoint without previously issued queries or opened transaction an error occurs: "Call to a member function exec() on null".
dbal/lib/Doctrine/DBAL/Connection.php
Line 1386 in 9b88bf3
How to reproduce
Make sure to call Doctrine\DBAL\Connection::createSavepoint when no connection was previously established.
Expected behaviour
The method should explicitly call Doctrine\DBAL\Connection::connect to create connection before issuing a SAVEPOINT query to the database.
The same behavior is already implemented for Doctrine\DBAL\Connection::beginTransaction and Doctrine\DBAL\Connection::rollBack methods.
The same approach could be also applied to Doctrine\DBAL\Connection::releaseSavepoint and Doctrine\DBAL\Connection::rollbackSavepoint.
The text was updated successfully, but these errors were encountered: