Problem/Motivation
The static variables in L10nHelper are not reset.
This leads to wrong behavior on repeated calls. Strings are created with the wrong file entity referenced.
Steps to reproduce
The tests in #3577854: Add tests for connector plugins reveal the bad behavior, and they will be fixed here.
Proposed resolution
Merge this first: #3577854: Add tests for connector plugins!
Implement a reset mechanism.
Normally we should go a bit further and move static variables from inside methods to class level.
But I am planning some more refactoring, so I want to keep this bug fix minimal.
Remaining tasks
User interface changes
API changes
Data model changes
Issue fork l10n_server-3582077
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
donquixote commentedComment #4
donquixote commentedComment #6
fmb commentedSo I take it this is a temporary solution, right? I understand how and why you are resetting global state, but honestly this is a blatant example why we should limit global state in the first place...
Comment #7
donquixote commentedIndeed it is meant to be temporary.
I have a big refactor in the pipeline, but I wanted to do these bug fixes first, so that we can separate refactoring from fixing, an have stable tests that cover these cases. I felt like the refactoring is too ambitious to include and delay all kinds of bug fixes.
(In its original meaning, refactoring does not include bug fixes or new features)
However, the refactoring only removes the global state in l10n_server package in the L10nHelper class.
It does not remove global state in potx module.
Gabor wants to be able to backport everything to potx for Drupal 7, this is why we don't see it change much.
Comment #8
pierregermain commentedComment #12
fmb commentedAlright, this is now merged, thanks.
Comment #14
donquixote commented@fmb You asked if we could remove the global state.
Here we go :) #3582331: Refactor ParserService potx string discovery