From: Alexander Ebert Date: Thu, 22 Dec 2016 16:20:33 +0000 (+0100) Subject: Fixed handling of broken ACP controllers X-Git-Tag: 3.0.0_RC_3~69 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=8940af9d9bf5c9deb27840f0f7e76ff043ca2263;p=GitHub%2FWoltLab%2FWCF.git Fixed handling of broken ACP controllers --- diff --git a/wcfsetup/install/files/lib/system/request/ControllerMap.class.php b/wcfsetup/install/files/lib/system/request/ControllerMap.class.php index 068d03b930..ac436f1eec 100644 --- a/wcfsetup/install/files/lib/system/request/ControllerMap.class.php +++ b/wcfsetup/install/files/lib/system/request/ControllerMap.class.php @@ -363,7 +363,29 @@ class ControllerMap extends SingletonFactory { * @return string url representation, e.g. 'board-list' */ public static function transformController($controller) { - $parts = preg_split('~([A-Z][a-z0-9]+)~', $controller, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + // work-around for broken controllers that violate the strict naming rules + if (preg_match('~[A-Z]{2,}~', $controller)) { + $parts = preg_split('~([A-Z][a-z0-9]+)~', $controller, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + + // fix for invalid pages that would cause single character fragments + $sanitizedParts = []; + $tmp = ''; + foreach ($parts as $part) { + if (strlen($part) === 1) { + $tmp .= $part; + continue; + } + + $sanitizedParts[] = $tmp . $part; + $tmp = ''; + } + if ($tmp) $sanitizedParts[] = $tmp; + $parts = $sanitizedParts; + } + else { + $parts = preg_split('~([A-Z][a-z0-9]+)~', $controller, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); + } + $parts = array_map('strtolower', $parts); return implode('-', $parts);