[site:install] Regression: command does not respect empty db-prefix #4189
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.
Problem/Motivation
The issue that was addressed in commit e62a1fe #3930 #3931 is back.
If you submit an empty string as DB prefix (
--db-prefix=''
) it is handled exactly as if no db-prefix was given: the command asks for a prefix regardless of the input. This is due to a regression first introduced by f1dc3aa #3917. This regression was partly reverted by 1247f20 #4049, but in both cases PHP’s implicit type casting causes problems.You have to check the input value explicitly against
null
, otherwise a blank string ("no prefix") will be handled like "no value given".How to reproduce
Result:
Solution
Avoid implicit type casting and check
$input->getOption('db-prefix')
againstnull
explicitly.