Bug #22561
closed
Some exceptions are not caught when trying to install DBAL in 1-2-3 Install Tool process
Added by Francois Suter over 14 years ago.
Updated over 14 years ago.
Category:
Database API (Doctrine DBAL)
Description
In tx_dbal_autoloader are 2 calls to t3lib_install::writeToLocalconf_control(). This method will throw an exception if the localconf.php file is not writable.
At least the first call should be in a try/catch block (we can hope the second call will succeed if the first did) and print out the exception's message. What is missing for now is an official way to issue such error messages, but it is planned as far as I know. It will probably be available via the callback reference to tx_install received by tx_dbal_autoloader, so it should be easy to use it.
The attached patch is just a rough solution to outline the issue.
(issue imported from #M14274)
Files
After having finally found what was wrong with the error handler, I could go further in the process and noticed another issue.
The call to t3lib_install::writeToLocalconf_control() may fail not only when localconf.php is not writable, but also when the folder "typo3conf" is not writable, because the method tries to write a temporary file first, when changes are made.
So the second call to t3lib_install::writeToLocalconf_control() should check the return value, which is "nochange" if writing failed. Here's another very rough patch of the kind of correction that must be made:
$result = $instObj->writeToLocalconf_control($lines);
if ($result === 'nochange') {
echo 'DBAL not loaded';
}
Without this, the loading of DBAL will fail silently and the user will never be given the choice to choose another DBMS. This is particularly critical because - up to that point - the user trying to install TYPO3 has not been told that typo3conf should be writable.
Committed 14274.diff to:
- DBAL trunk (rev. 32847)
- DBAL_1-1 (rev. 32848)
Thanks Francois.
Hmm, looking at the diff for revision 32847, you don't seem to have taken my second remark into account.
If you just keep calling:
$instObj->writeToLocalconf_control($lines);
without checking the result, you will fail catching that writing to the localconf.php may have failed and that DBAL is not actually loaded.
Hi Francois,
I agree with second point. Having a look at the problem...
Committed follow-up to
- DBAL trunk (rev. 33343)
- DBAL_1-1 (rev. 33344)
Now throws an exception if typo3conf is not writable which is catched and outputs a pretty error box:
Error
DBAL was not loaded. /Users/xavier/Sites/typo3dev.loc/mysql2/typo3conf/ is not writable!
Also available in: Atom
PDF