Feature #93174
closedCommand list unavailable, when command creation with container fails
100%
Description
The following scenario can be verified with TYPO3 11:
- Have a fully functional TYPO3
- Rename the db name in LocalConfiguration.php to a non existing one
- call bin/typo3
Reason for the failure is, that creation of extension:activate command object requires a working DB connection,
because its dependency InstallUtility needs one on object creation.
While certainly InstallUtility is a major culprit, because its many dependencies, several questions arise with this issue.
1. What is the expected (global) state on command object creation?
- is it valid to access TYPO3_CONF_VARS in constructor?
- is it valid to access database in constructor?
- is it valid to access TCA in constructor?
- is it valid to access ... in constructor?
Currently the boot state in constructor is different from TYPO3 install state, for commands registered via ServiceProvider.
When enssential config files exist, TYPO3 will be fully booted, otherwise only failsafe boot is preformed.
2. What is expected behaviour of the CLI tool, when object creation of one command object fails?
- fail the entire CLI (like it is now)?
- ignore the command that fails?
- ignore the command that fails, but show warning?
Depending on how we answer 1., we could define that object creation must never fail, thus object creation must never
depend on global state. In any case, the decision must be made and be documented
3. What is the expectation for the command list
- all registered commands should always be shown
- only commands should be shown that can be executed (depending on whether TYPO3 is set up or not)
- ...