> > > I think it is really nice that commit() throws for inactive > transactions. Code paths that mess up your transactions will not go > unnoticed that easily. >
+1. I've always found this behaviour in MySQL very surprising and error prone (BEGIN; BEGIN; COMMIT; COMMIT; => no errors), and I'm actually very happy to see this solved at PDO level. IMO if someone relies on commit() not throwing if there is no active transaction, they should be the one doing the extra check: if ($pdo->inTransaction()) $pdo->commit(). — Benjamin