mirror of
https://github.com/dg/dibi.git
synced 2025-08-15 10:34:06 +02:00
implemented PCRE error checking and PcreException
This commit is contained in:
@@ -62,6 +62,25 @@ if (!class_exists('FileNotFoundException', FALSE)) {
|
||||
class FileNotFoundException extends IOException {}
|
||||
}
|
||||
|
||||
if (!class_exists('PcreException', FALSE)) {
|
||||
/** @package exceptions */
|
||||
class PcreException extends Exception {
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
static $messages = array(
|
||||
PREG_INTERNAL_ERROR => 'Internal error.',
|
||||
PREG_BACKTRACK_LIMIT_ERROR => 'Backtrack limit was exhausted.',
|
||||
PREG_RECURSION_LIMIT_ERROR => 'Recursion limit was exhausted.',
|
||||
PREG_BAD_UTF8_ERROR => 'Malformed UTF-8 data.',
|
||||
5 => 'Offset didn\'t correspond to the begin of a valid UTF-8 code point.', // PREG_BAD_UTF8_OFFSET_ERROR
|
||||
);
|
||||
$code = preg_last_error();
|
||||
parent::__construct(isset($messages[$code]) ? $messages[$code] : 'Unknown error.', $code);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!interface_exists(/*Nette\*/'IDebugPanel', FALSE)) {
|
||||
require_once dirname(__FILE__) . '/Nette/IDebugPanel.php';
|
||||
}
|
||||
|
Reference in New Issue
Block a user