Skip to content
This repository has been archived by the owner on Nov 3, 2023. It is now read-only.

Local installation impossible in 3.5.25 #8681

Closed
Michael1972 opened this issue Mar 26, 2017 · 6 comments
Closed

Local installation impossible in 3.5.25 #8681

Michael1972 opened this issue Mar 26, 2017 · 6 comments
Assignees
Labels
Milestone

Comments

@Michael1972
Copy link

Michael1972 commented Mar 26, 2017

when performing a local installation in mampp, the following error-message appears after confirming the license-aggreement:

Fatal error: Uncaught exception Error with message Class 'Database\' not found thrown in system/modules/core/library/Contao/Database.php on line 165
#0 system/modules/core/library/Contao/Controller.php(1078): Contao\Database::getInstance()
#1 system/modules/core/library/Contao/Template.php(298): Contao\Controller::setCorsHeaders()
#2 system/modules/core/classes/BackendTemplate.php(120): Contao\Template->output()
#3 system/modules/core/controllers/BackendInstall.php(882): Contao\BackendTemplate->output()
#4 system/modules/core/controllers/BackendInstall.php(133): Contao\BackendInstall->outputAndExit()
#5 contao/install.php(20): Contao\BackendInstall->run()
#6 {main}
@fritzmg
Copy link
Contributor

fritzmg commented Mar 26, 2017

The problem seems to be that in your environment the following code does not return null:

\Environment::get('httpOrigin');

This causes Controller::setCorsHeaders (see Controller.php#L1065) to initiate the Database instance (see Controller.php#L1078), which of course will fail, since the config is incomplete at this point.

Try changing this line to:

if (!$strOrigin || \Environment::get('url') == $strOrigin)

@fritzmg
Copy link
Contributor

fritzmg commented Mar 26, 2017

@Toflar according to https://wiki.mozilla.org/Security/Origin#When_Origin_is_served_.28and_when_it_is_.22null.22.29 POST requests are also supposed to set the HTTP_ORIGIN header (though I cannot reproduce that locally with neither Chrome nor Firefox).

When accepting the license, you are sending a POST request. Thus

\Environment::get('httpOrigin');

will not be null and Controller::setCorsHeaders will be executed which will initiate the Database - which will fail.

@Toflar
Copy link
Member

Toflar commented Mar 26, 2017

Yeah this was fixed in Contao 4 already, only needs to be backported.

@fritzmg
Copy link
Contributor

fritzmg commented Mar 26, 2017

I see :)

@Michael1972
Copy link
Author

Michael1972 commented Mar 26, 2017

Works with the changed controller.php #1065. Great. Though I don't understand the code and its conclusions, the problem obviously doesn't appear with firefox or crome. I'm working with safari. Thanks.

@leofeyer leofeyer added this to the 3.5.26 milestone Mar 29, 2017
@leofeyer leofeyer self-assigned this Apr 18, 2017
@leofeyer
Copy link
Member

Fixed in 813ac56.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants