Fixed better error message for false database configuration

Marcus

Well-known member
Affected version
2.0.1
This may be a suggestion, not a bug.

Assuming /scr/config.php has false database configuration (user set to "root" instead of "xenforo-user").

I receive different error messages when accessing the forum by web and bash (which is okay), but I think the error message from sudo curl localhost could be improved.

Code:
http://locahost/

An exception occurred: [XF\Db\Exception] Access denied for user 'root'@'localhost' in src/XF/Db/Mysqli/Adapter.php on line 121

[LIST=1]
[*]XF\Db\Mysqli\Adapter->makeConnection() in src/XF/Db/Mysqli/Adapter.php at line 24
[*]XF\Db\Mysqli\Adapter->getConnection() in src/XF/Db/AbstractAdapter.php at line 46
[*]XF\Db\AbstractAdapter->connect() in src/XF/Db/AbstractAdapter.php at line 68
[*]XF\Db\AbstractAdapter->query() in src/XF/Mvc/Entity/Finder.php at line 1134
[*]XF\Mvc\Entity\Finder->fetch() in src/XF/Repository/UserRemember.php at line 54
[*]XF\Repository\UserRemember->validateRememberRecord() in src/XF/Repository/UserRemember.php at line 47
[*]XF\Repository\UserRemember->validateByCookieValue() in src/XF/Pub/App.php at line 281
[*]XF\Pub\App->loginFromRememberCookie() in src/XF/Pub/App.php at line 261
[*]XF\Pub\App->onSessionCreation() in src/XF/Pub/App.php at line 94
[*]XF\Pub\App->start() in src/XF/App.php at line 1876
[*]XF\App->run() in src/XF.php at line 328
[*]XF::runApp() in index.php at line 13
[/LIST]

Code:
# sudo curl localhost

<p>An exception occurred: [ErrorException] [E_NOTICE] Undefined index: defaultLanguageId in src/XF/App.php on line 962</p><ol>  <li><b class="function">XF::handlePhpError()</b> <span class="shade">in</span> <b class="file">src/XF/App.php</b> <span class="shade">at line</span> <b class="line">962</b></li>
        <li><b class="function">XF\App->XF\{closure}()</b> <span class="shade">in</span> <b class="file">src/XF/Container.php</b> <span class="shade">at line</span> <b class="line">228</b></li>
        <li><b class="function">XF\Container->create()</b> <span class="shade">in</span> <b class="file">src/XF/App.php</b> <span class="shade">at line</span> <b class="line">2288</b></li>
        <li><b class="function">XF\App->language()</b> <span class="shade">in</span> <b class="file">src/XF/Pub/App.php</b> <span class="shade">at line</span> <b class="line">118</b></li>
        <li><b class="function">XF\Pub\App->start()</b> <span class="shade">in</span> <b class="file">src/XF/App.php</b> <span class="shade">at line</span> <b class="line">1876</b></li>
        <li><b class="function">XF\App->run()</b> <span class="shade">in</span> <b class="file">src/XF.php</b> <span class="shade">at line</span> <b class="line">328</b></li>
        <li><b class="function">XF::runApp()</b> <span class="shade">in</span> <b class="file">index.php</b> <span class="shade">at line</span> <b class="line">13</b></li>
 
In fact, the different error messages depend on whether or not your browser contains cookies to try to log you in, but that's highlighted a new issue, in that we attempt to access options.defaultLanguageId before we've actually connected to the database...
 
Top Bottom