[TYPO3-core] RFC #9355: Add an error and exception handler (backported from FLOW3)

Rupert Germann rupi at gmx.li
Tue Sep 8 11:33:01 CEST 2009


Ingo Renner schrieb:
> Rupert Germann wrote:
>> the array of errorlevels should only contain that errors that can
>> actually reach handleError().
> 
> do they contain others? I didn't lok up the values and trust that Robert 
> & Co chose them wisely already... If they should be changed, make a 
> recomendation to which values they should be changed please, I'll adopt 
> that then.

I trust the PHP manual:
http://www.php.net/manual/en/function.set-error-handler.php

>> I don't get the point why we would need a "production exception
>> handler". we always recommanded to completely disable the display of php
>> errors/exeptions for production sites.
> 
> Did you actually test it? 

yes

I don't see an error/exception - at least in
> the way pure PHP would show them - which IMO is the purpose of the 
> exception handling.

I take the recommanded settings for production sites:
I set "display_errors = Off" in php.ini and ['SYS']['displayErrors'] = 
'0' in localconf (devIPmask doesn't match).

If I produce an E_ERROR or an E_PARSE in a php file I see a white page 
because error messages are suppressed and none of these errors hits the 
error_handler.
If I produce an uncought exception I get a message from the exception 
handler. but why did I disable the display of errors then?

before your patch this would produce an empty page, too.
that means the behaviour of ['SYS']['displayErrors']=0 was changed -> 
should be mentioned in the description of the option.

....
>> I'd like to see a possibility to disable error and exception handling
>> completely, which is not possible atm.
> 
> I'd rather not provide such an option, the exception handling is there 
> for a purpose at least.

In my eyes it has a purpose for development sites - but on a production 
site there are no errors in best case. So the always loaded exception 
handling will only slow things down.

to prevent this, simply wrap the FE initialisation in index_ts.php in a 
condition:

if ($TYPO3_CONF_VARS['SYS']['displayErrors'] != 0) {
...
init exception handling
...
}

then we can benefit from the enhanced possibilities in our development 
sites but our production servers are not slowed down.

>> now to some functional thingies:
>> display errors is enabled in php.ini
>> localconf:
>> $TYPO3_CONF_VARS['SYS']['devIPmask'] = '*';
>> $TYPO3_CONF_VARS['SYS']['displayErrors'] = '1';
> 
> even if display errors isn't enabled in php.ini, 
> ['SYS']['displayErrors'] = 1 would enable it. I'd recommend the "2" 
> setting though, which takes into account your devIPmask.

according to the description of [SYS][displayErrors] this is not 
recommanded: "... It is suggested that you set this to "0" and enable 
the "error_log" option in php.ini instead"

>> means: we use t3lib_error_DebugExceptionHandler
> 
> right, but why would you do this?

Because I test your patch !!!?

greets
rupert


More information about the TYPO3-team-core mailing list