I am currently working on a project to uses Yii and stumbled across something that made me scratch my head. I started a db transaction using Yii (which just calls PDO::beginTransaction) and did some database stuff and at the end, store a flash message for the user and do a redirect. I forgot though to commit the transaction so nothing got stored in my database, but what caught my attention is that my flash message also did not appear. Doing a commit or rollback makes the flash message appear just fine.
Basically, I noticed that I could not store any session related data and have it stick after a redirect if I started a transaction and didn't commit/rollback. I normally don't leave transactions hanging so I never noticed this behavior before.
So is there a relationship between the 2 that would prevent Sessions from working properly?
begin tran {a}; begin tran {b}; commit {for a, issued by b}; [implicit] rollback- the inner commit generally "doesn't stick" so a commit was issued for {b} when the transaction for {a} should already have been closed (which would explain why a rollback still worked). Since the {a} transaction wasn't closed, {b} is an inner transaction and not a secondary sequential transaction. That is my hunch of what is happening, anyway. - user2864740