Download & Extend

DatabaseControllerNG does not rollback failed ::save() operations

Project:Drupal core
Version:8.x-dev
Component:entity system
Category:bug report
Priority:major
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Missing use Exception; so the catch (Exception $e) does not catch \Exception.

Patch and tests to follow.

Comments

#1

Status:active» needs review

Patch with test demonstrating fail and then fix.

AttachmentSizeStatusTest resultOperations
database-storage-controller-ng-1885542.1.fail_.patch2.7 KBIdleFAILED: [[SimpleTest]]: [MySQL] 49,499 pass(es), 2 fail(s), and 0 exception(s).View details
database-storage-controller-ng-1885542.1.pass_.patch3.16 KBIdlePASSED: [[SimpleTest]]: [MySQL] 49,534 pass(es).View details

#2

Status:needs review» reviewed & tested by the community

Looks good to me.

#3

Component:documentation» database system

Not a documentation issue.

#4

Component:database system» entity system

sorry @jhodgdon

#5

Component:entity system» database system
Status:reviewed & tested by the community» needs work

This is somewhat minor, but AFAIK the standard is not to use Exception but instead to specify \Exception where it is used.

#6

Component:database system» entity system

Cross-post-o-rama!

#7

@webchick, http://drupalcode.org/project/drupal.git/blob/refs/heads/8.x:/core/lib/D... has 'use Exception', I'm not fussy either way - can change both if you like.

#8

Yeah, that's wrong. The reason for that is because if you forget the "use Exception" thing at the top, then basically stuff doesn't work. Since it's not easy to grep for ensuring for every "Exception" there's a corresponding "use Exception", we introduced a standard to prefix it with "\" everywhere so offenders are easier to pick out. This is true for any internal PHP class: See http://drupal.org/node/1353118 under "use"ing classes.

#9

Status:needs work» needs review

thanks, again in awe of how you keep all this in your head, new patch fixed both files.
sorry, no interdiff

AttachmentSizeStatusTest resultOperations
database-storage-controller-ng-1885542.9.patch4.05 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch database-storage-controller-ng-1885542.9.patch. Unable to apply patch. See the log in the details link for more information.View details

#10

Status:needs review» needs work

The last submitted patch, database-storage-controller-ng-1885542.9.patch, failed testing.

#11

Status:needs work» needs review

related #1634442: DatabaseStorageController can't catch exceptions

#12

Not sure what happened there, fresh re-roll against HEAD.

AttachmentSizeStatusTest resultOperations
database-storage-controller-ng-1885542.12.patch4.08 KBIdleFAILED: [[SimpleTest]]: [MySQL] 49,533 pass(es), 2 fail(s), and 0 exception(s).View details

#13

Status:needs review» reviewed & tested by the community

Looks sane enough.

#14

Status:reviewed & tested by the community» needs work

The last submitted patch, database-storage-controller-ng-1885542.12.patch, failed testing.

#15

I'm missing something. Hmmm

#16

Status:needs work» needs review

meh, missed one
find and replace fail.

AttachmentSizeStatusTest resultOperations
database-storage-controller-ng-1885542.15.interdiff.txt607 bytesIgnored: Check issue status.NoneNone
database-storage-controller-ng-1885542.15.patch4.39 KBIdlePASSED: [[SimpleTest]]: [MySQL] 49,547 pass(es).View details

#17

Status:needs review» reviewed & tested by the community

Looks good. Marking back to RTBC so it can be committed once tesbot's done verifying.

#18

Status:reviewed & tested by the community» needs review

Good catch.

Can we have a test-only patch to prove the test?

#19

Status:needs review» reviewed & tested by the community

Wait for red/green.

AttachmentSizeStatusTest resultOperations
exception-1885542-19-FAIL.patch2.69 KBIdleFAILED: [[SimpleTest]]: [MySQL] 49,537 pass(es), 1 fail(s), and 0 exception(s).View details
exception-1885542-19-PASS.patch4.39 KBIdlePASSED: [[SimpleTest]]: [MySQL] 49,608 pass(es).View details

#20

Status:reviewed & tested by the community» fixed

Great, thanks!

Committed and pushed to 8.x.

#21

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here