Permalink
Browse files

Enabling `ErrorHandler` exception-type checking to catch sub-classes …

…of the type given, and simplifying call stack checks to allow any stack frame intersection.
  • Loading branch information...
1 parent e0223e1 commit 8ed8e65cbab376920b3caad750f041e357c594b0 @nateabele nateabele committed Feb 15, 2011
Showing with 4 additions and 10 deletions.
  1. +4 −10 libraries/lithium/core/ErrorHandler.php
@@ -72,21 +72,15 @@ class ErrorHandler extends \lithium\core\StaticObject {
public static function __init() {
static::$_checks = array(
'type' => function($config, $info) {
- return (
- $config['type'] == $info['type'] ||
- is_subclass_of($info['type'], $config['type'])
- );
+ return (boolean) array_filter((array) $config['type'], function($type) use ($info) {
+ return $type == $info['type'] || is_subclass_of($info['type'], $type);
+ });
},
'code' => function($config, $info) {
return ($config['code'] & $info['code']);
},
'stack' => function($config, $info) {
- foreach ((array) $config['stack'] as $frame) {
- if (in_array($frame, $info['stack'])) {
- return true;
- }
- }
- return false;
+ return (boolean) array_intersect((array) $config['stack'], $info['stack']);
},
'message' => function($config, $info) {
return preg_match($config['message'], $info['message']);

0 comments on commit 8ed8e65

Please sign in to comment.