Problem/Motivation
During Drupal 8, we added support for \Drupal::MINIMUM_SUPPORTED_PHP
, which defines a PHP version that allows sites to run, but displays warnings on update and errors on the status report for existing sites. (New installations are not allowed except within the test runner.)
However, numerous tests now fail when MINIMUM_SUPPORTED_PHP
is actually used, either due to issues with the test or possible regressions in HEAD.
One of these tests is Drupal\Tests\system\Functional\UpdateSystem\NoPreExistingSchemaUpdateTest
. It fails because the message about missing schema information is added to the first page load in update.php
, whatever that may be. If the requirements warning page appears (as it will with an old PHP version), the message is displayed on that page, rather than the main update.php
intro. Since the test asserts that the message is displayed on the latter screen, it fails on a PHP version below \Drupal::MINIMUM_SUPPORTED_PHP
.
Proposed resolution
We discussed whether to change the actual functionality in HEAD so that the message was consistently displayed on the main screen of update.php
. (See #13, #15, and comments from the previous MR below that.) This approach was not reliable because it would not display the message if the user didn't immediately continue past the requirements warnings, and also was complicated to implement reliably when updates were run from other code paths (e.g. drush).
The current approach is to simply change the test by moving the assertion earlier, so that it will pass regardless of whether the next screen is the warning screen or the normal intro.
There are three MRs:
- 3265378-FAIL increases the minimum supported PHP version so that the PHP 7.3 test environment will expose the bug, plus skips some other test failures covered in other issues.
- 3265378-move-assertion combines the failing version with the change to the test to prove that the issue is resolved.
- 3265378-fix-only is the version for commit.
Remaining tasks
NR.
User interface changes
N/A
API changes
N/A
Data model changes
N/A
Release notes snippet
Comment | File | Size | Author |
---|
Issue fork drupal-3265378
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 #2
xjmComment #4
xjmComment #5
xjm#3265412: QuickStartTestBase is incompatible with the current implementation of MINIMUM_SUPPORTED_PHP causes the remaining out-of-scope failures.
Comment #6
daffie CreditAttribution: daffie commentedThe MR only is showing that it is failing. Where is the one with the fix?
Comment #7
xjm@daffie, sorry, I forgot that MRs and/or alternate environment tests don't automatically set issues NW for failures. This was just a bit of TDD. I've been debugging locally and the browser output makes it appear that either HEAD is actually broken or the test makes faulty assumptions. Will post more detail later on this and #3265377: Fix LocaleTranslatedSchemaDefinitionTest when MINIMUM_SUPPORTED_PHP is used.
Comment #8
xjmComment #10
xjmSo the test failure is:
The thing about this test is that it is already using
$this->updateRequirementsProblem()
correctly:On PHP 7.4
This is what the HTML output from the test is supposed to look like, on PHP 7.4:
On PHP 7.3
When the test is run on PHP 7.3, there are two screens instead of one, from successfully clicking past the warning:
Note that the text from the final assertion is shown on the first page, with the PHP warning, instead of the second. So this is sort of an actual bug in core.
We could just change the test so that the assertion is called earlier, when it will pass regardless of whether the PHP is below the supported minimum or not, as is done in 3265378-move-assertion. However, I'm not sure that's the correct fix because the message about the schema information makes more sense in the context of the main
update.php
screen. If it's presented on the warnings screen, there's too much different information for the site owner to address at once.Comment #11
xjmThe message is added at the end of _update_fix_missing_schema(), which in turn is called from update_check_requirements():
Because the message is added before the requirements warnings are handled, this means it shows up on the warnings screen, rather than the main database update page.
To fix this, we'd have to additionally add some custom code in DbUpdateController::handle() to check whether the message is loaded, save it, unset it, and reset it after the requirements warning happens...
Or, to avoid some of that we could move the logic directly into
DbUpdateController::handle()
, which would allow us to check for the problematic condition early, but then raise the message later after the warning handling. I'll try to code that up.Comment #13
xjm3265378-move-messages implements #11, by moving the messages to state when there are warnings and fetching them from state when the user has clicked past the warnings.
On PHP 7.3, the message is no longer displayed on the warnings page:
Instead, it is moved to the correct screen:
So the question is whether to make that change, which means more code paths to clean up later in the handler when #3130037: system.schema information gets out of sync with module list is fixed, or just to live with the message being on the wrong page and change the test.
Comment #14
xjmComment #15
xjmOTOH maybe displaying the warning on the first screen is correct, in case they never click past the warning?
update.php
has already attempted to fix the schema at the start, so something has changed and maybe we should inform the site owner then.Not sure which approach is best. Updating the IS with both.
Comment #16
xjmComment #17
catchLeft a comment on one of the MRs - if that comment is correct, then I'd be tempted to go for the test-only change here.
Comment #20
xjmComment #21
xjmComment #22
xjmComment #23
daffie CreditAttribution: daffie commentedThe 3 MR's convince me that the fix is the right one.
For me it is RTBC.
Comment #27
catchCommitted eb75b5e and pushed to 10.0.x. Thanks! Also cherry-picked to 9.4.x and 9.3.x