Problem/Motivation
In #3388540: Orphan Purger not triggered when deleting revisions, we identified a behavior change in 11.3, where hasTranslationChanges() suddenly returns TRUE when it previously returned FALSE, causing extra revisions to be created.
Additionally, using loadRevision() might now hit the static cache depend on what and how it's loaded and must use loadRevisionUnchanged().
Steps to reproduce
create an entity, save, save a new revision with a different title. load the old revisions, call hasTranslationChanges(). Without making any changes, this will return TRUE as it compares against the default revision.
Because it doesn't use loadRevisionUnchanged(), the same should happen when saving non-default revision and loading that.
Proposed resolution
I think it should always load the revision if it's an entity type that supports revisions.
Remaining tasks
User interface changes
Introduced terminology
API changes
Data model changes
Release notes snippet
Issue fork drupal-3562759
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
berdirComment #4
amateescu commentedDiscussed this a bit in Slack, and the conclusion looks good to me. Nice find :)
Comment #5
catchI've stared at this a couple of times without committing it, thinking it would be nice to have an inline comment explaining why we need the unchanged revision to be loaded. But all I end up with is 'We must load the unchanged revision so it can be compared correctly' or similar which does not add anything. So... going ahead here without that, the test coverage should stop anyone changing it back mistakenly.
Committed/pushed to main, 11.x and 11.3.x, thanks!