From c1407fb12dec28abac5ab45834edaf89b523480b Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 7 Jun 2012 16:34:01 +0200 Subject: [PATCH] Fixed Error-Handling of Regex.class.php --- wcfsetup/install/files/lib/system/Regex.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/wcfsetup/install/files/lib/system/Regex.class.php b/wcfsetup/install/files/lib/system/Regex.class.php index 848a3245f9..4eae656de4 100644 --- a/wcfsetup/install/files/lib/system/Regex.class.php +++ b/wcfsetup/install/files/lib/system/Regex.class.php @@ -6,7 +6,7 @@ use \wcf\system\exception\SystemException; * Represents a regex. * * @author Tim Düsterhus - * @copyright 2011 Tim Düsterhus + * @copyright 2011 - 2012 Tim Düsterhus * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage system @@ -181,7 +181,7 @@ final class Regex { * @param mixed $result */ private function checkResult($result, $method = '') { - if ($result === false) { + if ($result === false || $result === null) { switch (preg_last_error()) { case PREG_INTERNAL_ERROR: $error = 'Internal error'; @@ -195,10 +195,12 @@ final class Regex { case PREG_BAD_UTF8_ERROR: $error = 'Bad UTF8'; break; + case PREG_NO_ERROR: + return $result; default: $error = 'Unknown error'; } - + throw new SystemException('Could not execute '.($method ? $method.' on ' : '').$this->regex.': '.$error); } return $result; -- 2.20.1