Fixed handling of empty components causing to yield the wrong separator
authorAlexander Ebert <ebert@woltlab.com>
Sat, 21 Mar 2015 13:09:35 +0000 (14:09 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sat, 21 Mar 2015 13:09:35 +0000 (14:09 +0100)
wcfsetup/install/files/lib/system/request/FlexibleRoute.class.php

index d6d9bb90e91188be960cae106e8633f8b8604b2c..b9397e135307801f6f6700204495e14fa0da8957 100644 (file)
@@ -183,19 +183,22 @@ class FlexibleRoute implements IRoute {
                
                if ($useBuildSchema) {
                        $lastSeparator = null;
+                       $skipToLastSeparator = false;
                        foreach ($this->buildSchema as $component) {
                                $value = $component['value'];
                                
                                if ($component['type'] === 'separator') {
                                        $lastSeparator = $value;
                                }
-                               else {
+                               else if ($skipToLastSeparator === false) {
                                        // routes are build from left-to-right
                                        if (empty($components[$value])) {
+                                               $skipToLastSeparator = true;
+                                               
                                                // drop empty components to avoid them being appended as query string argument
                                                unset($components[$value]);
                                                
-                                               break;
+                                               continue;
                                        }
                                        
                                        if ($lastSeparator !== null) {