Bug #1278

Router matches static route parts even on substrings

Added by Robert Lemke about 11 years ago. Updated almost 9 years ago.

Status:
Resolved
Priority:
Must have
Category:
MVC
Target version:
-
Start date:
2008-08-13
Due date:
% Done:

100%

PHP Version:
Has patch:
Complexity:

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 (diff)
Added by Robert Lemke about 11 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 (diff)
Added by Robert Lemke about 11 years ago

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

Revision 26143959 (diff)
Added by Bastian Waidelich about 11 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 about 11 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 about 11 years ago

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

Applied in changeset r1137.

Also available in: Atom PDF