Issue #3618674: Use getOriginal() instead of the magic property Drupal 12 removes
Reading $entity->original is deprecated in drupal:11.2.0 and removed from drupal:12.0.0 in favour of EntityInterface::getOriginal() (change record). Core renamed its own real property to $originalEntity specifically so it would not clash with the deprecated magic one, so on core 12 the magic getter is gone, the expression evaluates to NULL, and any call through it fatals.
Symptom
Error: Call to a member function getAccessRules() on null
src/WebformEntityStorage.php:101 (doPostSave)
← Webform::save()Saving any Webform config entity dies, which is enough to break every kernel test that creates one. Because it happens in setUp() rather than in an assertion, the tests error rather than fail, which makes it look environmental.
Three files, five sites
| file | what changes |
|---|---|
src/WebformEntityStorage.php |
$entity->original->getAccessRules() becomes $entity->getOriginal()->getAccessRules() |
src/Entity/WebformSubmission.php |
the isset($this->original) guard plus two calls through it; the guard becomes a NULL check, because getOriginal() returns NULL rather than leaving a property unset |
src/Hook/WebformEditorHooks.php |
$webform->original passed into _webform_get_config_entity_file_uuids() |
Fixing only the site the stack trace names is not enough: the next one takes over. I grepped the branch for every remaining use, excluding $originalData, $originalEntity and getOriginalId(), which are unrelated.
getOriginal() exists from 11.2, so this needs no version guard on a branch supporting ^10.3 || ^11.
How it was found
On a Drupal 12 pipeline in another module's CI, after the MRs on [#3618362] (plugin manager signatures) and [#3618665] (the removed archiver service) cleared the two earlier failures. This is the third distinct Drupal 12 break in webform and the first that stops the module working rather than only warning.