-
-
Notifications
You must be signed in to change notification settings - Fork 212
[3.3.6] Problem with Database::getInstance() #7412
Comments
Same with a clean
|
Why would we need a workaround for that? Just run the install tool? |
Andreas, the problem is that this is not catch able as it is a fatal error. |
Are you using the |
Yes I am. However I strictly am against trying to work around a bug by cutting functionality. It is a bug to raise a fatal error instead of an exception from which can be recovered from. |
Not saying you’re wrong, but the standalone install tool will solve this problem in Contao 4 …= |
Yep, I know. But waiting until Contao 4 is lts for such a problem to disappear is a bit harsh. ;) |
Absolutly
I just thought removing the hook would fix this and potentially other issues, what would be your solution? |
Just for a further explanation, that the core itself can not handle a incomplete installation:
Removing the initilize Hook is not a solution. |
It just checks if the localconfig file is there. |
So the method naming is wrong ;) or the config file should not be created, when I accept the license. Isn't there a minimum Config Setup, which is neccesary to get Contao running? Some DB Settings, license, encryptionKey, etc. If they aren't set, the Installation is not complete. Or do i missunderstand something? |
Please try replacing line 158 of if (!isset(static::$arrInstances[$strKey]) && !empty($arrConfig['dbDriver'])) It does not fix the underlying problem (which will only be fixed with a stand-alone installer), but it improves the situation. |
Of course, we could also check for a database driver in |
@leofeyer your Suggestion fixes the error. IMHO than better remove the function |
Even if a DB driver is selected, that does not mean Contao can run (e.g. incorrect DB access details)= |
Those are the config params from my localconfig after a clean installation: $GLOBALS['TL_CONFIG']['licenseAccepted'] = true;
$GLOBALS['TL_CONFIG']['installPassword'] = 'somepasswordhash';
$GLOBALS['TL_CONFIG']['encryptionKey'] = 'somekey';
$GLOBALS['TL_CONFIG']['dbDriver'] = 'MySQLi';
$GLOBALS['TL_CONFIG']['dbHost'] = 'localhost';
$GLOBALS['TL_CONFIG']['dbUser'] = 'root';
$GLOBALS['TL_CONFIG']['dbPass'] = ''; // important, could be empty ;)
$GLOBALS['TL_CONFIG']['dbDatabase'] = 'contao-3.3.5';
$GLOBALS['TL_CONFIG']['dbPconnect'] = false;
$GLOBALS['TL_CONFIG']['dbCharset'] = 'UTF8';
$GLOBALS['TL_CONFIG']['dbPort'] = 3306;
$GLOBALS['TL_CONFIG']['dbSocket'] = ''; // important, could be empty ;)
$GLOBALS['TL_CONFIG']['adminEmail'] = '[email protected]'; If all of these options are set, the config is complete and Contao is able to run. Maybe with contao 4 a stand-alone installer is comming ;) |
That's wrong. Most of the database parameters (e.g. If we want to add some checks to the $GLOBALS['TL_CONFIG']['licenseAccepted'] === true;
$GLOBALS['TL_CONFIG']['encryptionKey'] !== '';
$GLOBALS['TL_CONFIG']['dbDriver'] !== '';
$GLOBALS['TL_CONFIG']['adminEmail'] !== ''; @contao/developers Does this make sense to you? |
Changed in 108d724. We must not check for |
@leofeyer sounds perfect. thanks ;) |
There is a Problem with the
Database::getInstance()
when the config is not complete (no SQL settings)This Error occured while trying to install MetaModels in a blank Contao with no localconfig.php.
See this line:
core/system/modules/core/library/Contao/Database.php
Line 160 in ac32cb4
There will be instanciate a none existing Class
Database\
if the$arrConfig['dbDriver']
is not set.Metamodels Fix: MetaModels/core@ac126a0
The text was updated successfully, but these errors were encountered: