contao / core-bundle

[READ-ONLY] Contao Core Bundle
GNU Lesser General Public License v3.0
123 stars 58 forks source link

no pretty error screen on refused database connection #1626

Closed fritzmg closed 6 years ago

fritzmg commented 6 years ago

In Contao 4.5.10, if the database connection is actively refused for whatever reason, every route including /contao/install, will only display the following:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>An Error Occurred: Not Found</title>
    </head>
    <body>
        <h1>Oops! An Error Occurred</h1>
        <h2>The server returned a "404 Not Found".</h2>

        <div>
            Something is broken. Please let us know what you were doing when this error occurred.
            We will fix it as soon as possible. Sorry for any inconvenience caused.
        </div>
    </body>
</html>
<!DOCTYPE html>
<html>
    <head>
        <meta charset="UTF-8" />
        <title>An Error Occurred: Internal Server Error</title>
    </head>
    <body>
        <h1>Oops! An Error Occurred</h1>
        <h2>The server returned a "500 Internal Server Error".</h2>

        <div>
            Something is broken. Please let us know what you were doing when this error occurred.
            We will fix it as soon as possible. Sorry for any inconvenience caused.
        </div>
    </body>
</html>

The dev environment will show the following errors: https://pastebin.com/C7cm4HC7

Shouldn't the pretty error screen be shown in the prod environment instead?

m-vo commented 6 years ago

Sounds a bit like the issue in #1422 where Doctrine throws an exception before the kernel is booted (and therefore the listener for pretty error screens doesn't not kick in)?

fritzmg commented 6 years ago

Right, I forgot about that. Probably not an issue that's easily solved. Closing :)

m-vo commented 6 years ago

Hmm. I not sure how the /contao/install route works before entering database credentials. But wouldn't the same error appear if a wrong username/password/port was entered?

fritzmg commented 6 years ago

No, because if host and port are correct, Doctrine can establish an initial connection to determine the MySQL server version. Also I think the install tool checks the connection first before saving it to the parameters.yml? So this problem only occurs, if database connection information is already present in the parameters.yml.

m-vo commented 6 years ago

It's still bad that you can enter whatever you want in the installer and it still works but everything goes away if e.g. the mysql server isn't reachable. :smile: