[TYPO3-core] RFC #14275: Bug: Error handler does not catch exception while connecting to DB

Francois Suter fsu-lists at cobweb.ch
Sat May 1 22:34:42 CEST 2010


This is an SVN patch request.

Type: Bugfix

Bugtracker references:
http://bugs.typo3.org/view.php?id=14275

Branches:
4.3 and trunk

Problem:
The base error handler (t3lib_error_ErrorHandler) tries to connect to 
the database if the connection doesn't yet exist (this can happen 
because the error handler may be called very early during TYPO3 
initialization).
The DB connection method may throw exceptions if the connection failed. 
These exceptions should be caught by the error handler. No processing is 
needed, as there's nothing more that can be done anyway.

Solution:
Wrap the call to connectDB() in a try/catch block and do nothing more.

Notes:
1) The effect of not having a DB connection is that DB-based logs cannot 
be used. t3lib_error_ErrorHandler::writeLog() does indeed check for DB 
connection existence before trying to write to the sys_log table, so 
this is covered for the error handler. As for external tools, such as 
those called via t3lib_div::devLog() they just have to care for such a 
check themselves (extension "devlog" does this).

2) although this bug appeared because of the new operations performed in 
the Install Tool in the current trunk, I think the fix should be applied 
to 4.3 too.

3) the error handler doesn't use the existing API for testing the 
existence of the DB connection. I'll change that in a separate clean up.

Cheers

-- 

Francois Suter
Cobweb Development Sarl - http://www.cobweb.ch

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 14275.diff
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20100501/b0e04e82/attachment.asc>


More information about the TYPO3-team-core mailing list