Two places commit a database transaction by letting the Transaction object go out of scope. Core deprecated that in 11.5 and removes it in 13.0: "Database commit by letting a Transaction object go out of scope is deprecated in drupal:11.5.0 and is removed from drupal:13.0.0. Commit explicitly via Transaction::commitOrRelease() instead."
The two sites
WebformEntityStorage::getSerial(), where the reliance is deliberate and documented in a comment above the call.WebformSubmissionStorage::resave(), where the success path returns from inside the try block, so the commit happens as the method returns.
Those are the only two startTransaction() calls in the branch, and there are no commitOrRelease() calls yet.
Keeping Drupal 10 support
Transaction::commitOrRelease() exists from Drupal 11.3, while 6.3.x supports ^10.3 || ^11, so the call is guarded with method_exists(). Where the method is absent the existing end-of-scope commit still applies and raises no deprecation on that core version, so behaviour is unchanged there. This is the same guard shape as #3618674: The removed $entity->original magic property is still used in five places, breaking Drupal 12, and the conditional can be dropped whenever the branch drops Drupal 10.
Two details worth noting
- The
rollBack()in the catch block ofresave()is kept. An out-of-scope Transaction commits rather than rolls back, so that call was never redundant. getSerial()loses itsphpcs:ignorefor an unused variable, because the transaction handle is now read.
How it was found
webform 6.3.0 is installed as a test dependency of another module whose CI runs its suite against core 12.x-dev with --fail-on-deprecation. Once #3618362: Align definitions of getSortedDefinitions and getGroupedDefinitions with core, #3618665: webform_submission.exporter injects plugin.manager.archiver, which Drupal 12 removes, #3618674: The removed $entity->original magic property is still used in five places, breaking Drupal 12 and #3537314: file_get_content_headers() is deprecated in 11.2.0 are applied, these two sites are the only deprecations webform still raises there.
This one is removed in 13.0 rather than 12.0, so unlike those four it does not block Drupal 12. It is a cleanup that will be needed either way.
Related, both touching the same two methods but not this deprecation: #3568054: WebformSubmissionStorage::resave() does not reset entity cache, causing stale data on subsequent loads is open on resave(), and its !807 applies cleanly alongside this change in either order. #3208156: Optimize next_serial calculation and #2950217: Fix undefined and unused variables are closed and touched getSerial(), including the phpcs:ignore removed here.
AI-Generated: Yes (Claude Code was used to help draft this issue summary and to write the change on the merge request. I reviewed both, and the change was verified to apply to released 6.3.0 and to clear the deprecation on a real Drupal 12 CI run.)
Issue fork webform-3618696
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
cilefen commentedI would omit the "Drupal 11.3 added Transaction::commitOrRelease()..." comments, as they are restatements of the Git log.
Comment #4
mably commentedThanks. Agreed on the first sentence: it restates the Git log, and it is also inaccurate.
Transaction::commitOrRelease()was added in 11.3, but the deprecation is a separate and later change:Database::commitAllOnShutdown()is deprecated in 11.5 and removed in 13.0, see the change record. Dropped from both comments.I kept a single line, because it explains why the call is guarded rather than what changed upstream. This branch targets 6.3.x, which supports
^10.3 || ^11.0, so on 10.3 through 11.2 the method does not exist and the transaction still commits when the object goes out of scope. Without that note,method_exists()on a core class reads as unnecessary. The comment is now: Older supported core releases have no commitOrRelease(); there the transaction still commits when $transaction goes out of scope. The guard and its comment can both go whenever Drupal 10 support ends.Pushed to the merge request.
AI-Generated: Yes (Claude Code was used to help draft this comment and the change on the merge request. I reviewed it myself before posting.)