Do not check version if not provided #624
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When the Configuration page of the module is opened, the checklist is being verified. Function UpgradeSelfCheck::checkKeyGeneration() is called but at this moment
$this->upgrader->version_num
is NULL so the use of version_compare triggers a warning.At the beginning I was worried about
$this->upgrader->version_num
being NULL. But then I explored the code and actually I found that$this->upgrader->version_num
is set in UpgradeContainer::getUpgrader() and it depends on the channel chosen. The version number variable will be set from different locations if the target version is available on the API, in a file or in a directory. So it makes sense that, when the page is opened, it is not yet set and then it is NULL.So my solution to avoid the warning is simply not to perform the comparison if
$this->upgrader->version_num
is NULL as this is a valid usecase.