Fixed class name generation
authorAlexander Ebert <ebert@woltlab.com>
Tue, 8 Nov 2011 18:17:58 +0000 (19:17 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 8 Nov 2011 18:17:58 +0000 (19:17 +0100)
wcfsetup/install/files/lib/system/cache/builder/OptionCacheBuilder.class.php

index 5e8d82cb3254e7612d9fd330d7a71fa52c8b831b..33652b4844997c13d594ff4a371838b2666ef6f6 100644 (file)
@@ -94,13 +94,15 @@ class OptionCacheBuilder implements ICacheBuilder {
                        // get option class from type
                        $className = 'wcf\data\option\Option';
                        if (!empty($type)) {
-                               preg_match_all('~((?:^|[A-Z])[a-z]+)~', $type, $matches);
+                               // strip trailing underscore
+                               $rawType = substr($type, 0, -1);
+                               preg_match_all('~((?:^|[A-Z])[a-z]+)~', $rawType, $matches);
                                if (isset($matches[1])) {
                                        $className = 'wcf\data\\';
-                                       for ($i = 0, $length = sizeof($matches[1]); $i < $length; $i++) {
+                                       for ($i = 0, $length = count($matches[1]); $i < $length; $i++) {
                                                $className .= $matches[1][$i] . '\\';
                                        }
-                                       $className .= ucfirst($type);
+                                       $className .= 'option\\' . ucfirst($rawType) . 'Option';
                                }
                        }