Bug #1278

Router matches static route parts even on substrings

Added by Robert Lemke almost 13 years ago. Updated over 10 years ago.

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

100%

Estimated time:
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".

#1

Updated by Robert Lemke almost 13 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 13 years ago

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

Applied in changeset r1137.

Also available in: Atom PDF