-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Throw exception when committing and no transaction is started #29505
Comments
Heya, thanks for submitting this. This seems like a feature request or an improvement. It's best to post these at the laravel/ideas repository to get support for your idea. After that you may send a PR to the framework. Please only use this issue tracker to report bugs and issues with the framework. Thanks! |
This is not a feature, it's a bug and can lead to serious data inconsistencies without anybody noticing it! (actually happend in the project I am currently working on) |
@digilist then why did you mark this as "feature" in your issue template? Please try to properly fill out issue templates when posting them. I think maybe an exception could indeed work here. Can you maybe send in a PR with a test? |
@driesvints I have created PR, it is first time i am contributing, please drive me if i have done something wrong thanks. :) |
A pr for this fixed this for 6.0: #29067 |
This PR does not fix the handling of |
@digilist right! My bad, sorry. |
@driesvints I have opened a PR on this issue. First time contributor here, please be gentle. 😄 |
Unfortunately we've decided that we won't be pursuing a fix for this, sorry. The risk that it'd break apps is too great. |
@driesvints So having a bug that might silently lead to inconsistent databases is better than forcing some users to fix this? Why not start at least with logging on critical level and later convert it to an exception? |
@digilist I'm sorry but we had to weigh against the downside of this breaking apps. You're free to open an issue on the ideas repo to think about alternative solutions or what's your proposing in the above comment. |
Description:
framework/src/Illuminate/Database/Concerns/ManagesTransactions.php
Lines 154 to 163 in e778e32
In cases where the user calls
commit()
more often thanbeginTransaction()
(e.g. becausebeginTransaction()
is removed by accident) the user will never notice.This method should throw an exception instead, because otherwise the user will never notice (that the transaction has been committed to early or that no transaction is active at all).
@GrahamCampbell already pointed to that issue in #12382 and #14085 but was ignored...
The text was updated successfully, but these errors were encountered: