From: Tim Düsterhus Date: Thu, 7 Jun 2012 14:34:01 +0000 (+0200) Subject: Fixed Error-Handling of Regex.class.php X-Git-Tag: 2.0.0_Beta_1~1037^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c1407fb12dec28abac5ab45834edaf89b523480b;p=GitHub%2FWoltLab%2FWCF.git Fixed Error-Handling of Regex.class.php --- 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;