[patch] error masks

From: Date: Mon, 24 Aug 2009 18:17:26 +0000
Subject: [patch] error masks
Groups: php.internals 
Request: Send a blank email to internals+get-45348@lists.php.net to get a copy of this message
Hi! I've implemented a patch that allows to "mask" certain types of errors - i.e. make PHP engine completely ignore them. Now even if the error is not reported, it passes full cycle through message string creation, all allocations on the way, etc. even though ultimately the result of it will be thrown out. So I offer a way to make unwanted errors just disappear. The patch uses new directive - "error_mask", and reuses orig_error_reporting global (which is not used anywhere in PHP source so I wonder why it exists at all, but that's certainly convenient :) which makes it binary-compatible and fit for 5.3. Of course, in HEAD we could rename it. If the value in not 0, that's the mask which would filter out all errors that do not fit the mask (i.e. you could say in production that everything but warnings and errors should be discarded), and if the value is 0 then the mask is the same as error_reporting - i.e. it can be more dynamic and account for @, etc. and all non-reported errors will be discarded. Fatal errors will never be discarded. Alternative approach may be to just discard all non-reported errors, but that could be a problem with user error handlers and extension-supplied error callbacks, so the proposed approach is more flexible as you could control discarding and reporting separately. So, what do you think? -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com

« previous php.internals (#45348) next »