Bug #1278

Router matches static route parts even on substrings

Added by Robert Lemke almost 7 years ago. Updated almost 5 years ago.

Status:Resolved Start date:2008-08-13
Priority:Must have Due date:
Assigned To:Bastian Waidelich % Done:

100%

Category:MVC
Target version:-
PHP Version: Complexity:
Has patch: Affected Flow version:

Description

Consider these two routes:

1) typo3/[@controller]
2) typo3cr/[@controller]

Currently route 1) will match this url pattern:

http://myhost/typo3cr/

... because the static route part does not know that the segment is longer
than 5 characters, the "typo3" pattern will match. This is due to the ability
to match patterns like "typo3/[@controller]/[@action].[@format]"

The static route part does not have the split string information and therefore
cuts off the beginning of the url according to the length of the "name".

Associated revisions

Revision dd08efba
Added by Robert Lemke almost 7 years ago

  • FLOW3: (Configuration) Made sure that the global settings and the routing configuration is always loaded in the same order (and does not depend on the file system's ordering abilities). Asserted that the FLOW3 routing and settings are always loaded first. Relates to #1278
  • FLOW3: (MVC) A few cosmetic changes.

Revision 3e72dc4d
Added by Robert Lemke almost 7 years ago

  • FLOW3: Marked the previously, mistakenly committed test as skipped. Relates to #1278

Revision 26143959
Added by Bastian Waidelich almost 7 years ago

  • FLOW3: (MVC) Added check to F3_FLOW3_MVC_Web_Routing_StaticRoutePart: if its the last route part in the current URL segment, name of the route part must be exactly the same as the remaining string in the segment. This is a temporary fix and will be refactored soon. This fixes #1278.

History

#1 Updated by Robert Lemke almost 7 years ago

Maybe this test helps:

/**
 * @test
 * @author Robert Lemke <robert@typo3.org>
 */
public function staticRoutePartDoesNotMatchIfNameIsEqualToTheBeginningOfTheFirstUrlSegmentButTheSegmentIsLonger() {
    $this->routePart1->setName('foo');
    $urlSegments = array('foos', 'bar');

    $this->assertFALSE($this->routePart1->match($urlSegments));
}

#2 Updated by Bastian Waidelich almost 7 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

Applied in changeset r1137.

Also available in: Atom PDF