New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can no longer install with Doctrine DBAL 2.5 #54
Comments
@contao/developers @fritzmg /cc |
Who's Doctrine? The bundle? The bundle extension? |
When does that error happen? When you call the install tool? The screenshot does not include the whole stack trace :) |
See: doctrine/dbal#990 |
The quickest solution would be to add a conflict with 2.5? |
The solution is fairly simple. We cannot assume a complete installation without a working DB connection. Adjust to the following: // class Contao\Config
public static function isComplete()
{
if (static::$blnHasLcf === null || !static::has('licenseAccepted'))
{
return false;
}
try
{
\Database::getInstance()->listTables();
}
catch (\Exception $e)
{
return false;
}
return true;
} |
@aschempp but this would introduce two additional database queries on each request. |
True, we should probably perform the DB check only when we're in the install tool. Another option would be to store |
This does not fix the issue, because the problem originates somewhere else. https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php#L429 As you can see in the stack trace, the |
It does fix the issue in my installation. |
Nope, sorry. Your fix is not working. |
Well to me the install tool must work without DB, everything else cannot work. Idk why the command tries to connect to the database? |
Because Doctrine DBAL tries to connect to the database to retrieve the version number. https://github.com/doctrine/dbal/blob/master/lib/Doctrine/DBAL/Connection.php#L429 And this already happens in And all of this happens way before the installation controller is even constructed! |
In my case no connection to the database was made if noone queried something… |
This error will probably only occur, if you do not allow anonymous connections to your database server (see also contao/core-bundle#736). |
Yes, that's true. If anonymous connections are allowed, the issue does not occur. But that's rarely the case fortunately. |
I have commented here to document the issue. |
It seems that our |
Sounds like your GUI config bundle needs to be able to handle when the DB credentials are missing or are no longer valid? Perhaps you could register a This is assuming your GUI config bundle is in the business of editing config.yml, which seems like a possibility :) |
@mattjanssen Thanks a lot for your input. Much appreciated. |
We are now dynamically adding |
@leofeyer should we add an |
If |
Unit tests would tell you :P
|
No true in this case. If doctrine:
dbal:
connections:
default: 'string' <-- this is wrong! |
Not really, because the data is coming from other bundles. I think the unifying of TreeBuilder is only done after our method. According to https://github.com/doctrine/DoctrineBundle/blob/master/DependencyInjection/Configuration.php#L69 it's actually possible to set the connection details directly in |
Is this actually fixed in Contao 4.4.0? I am unable to open the Install Tool once I have removed the anonymous user accounts from my SQL database. Stack trace seems to be the same as posted by @leofeyer // nvm, suddenly it worked after clearing the dev cache |
Doctrine DBAL 2.5 has added the
server_version
parameter. It it is not given, Doctrine tries to read it from the MySQL server, thus enabling a database connection, which leads to anAccess denied for user ''@'localhost'
exception.Related issue: kriswallsmith/assetic#681
The text was updated successfully, but these errors were encountered: