I ran into an issue with installing Magento, when the codebase already contains modules with custom CLI commands.
As far as I've been able to track down the issue, here's what happens:
- The ObjectManagerProvider class contains a call to createCliCommands, which will go over all defined CLI commands to initialize them
- The CLI command class can (direct or indirect) depend on the \Magento\Framework\Locale\Resolver class
- The locale resolver calls setLocale in the constructor, which in turn will call the ScopeConfig class to determine the default locale
- The scope config class will fail since it will try to access database tables that don't exist yet
So my main question: does anyone know why Magento would need to call createCliCommands during the setup phase at all? I couldn't figure out a good reason for it. Commenting out that line will result in a normal install without problems. And especially since it only does so when called from cli SAPI, this seems to lead to different results between cli install or web install. I'm just curious if this might be a bug or if there is actually a valid reason for doing this.