Bug #7831

Router interprets negative integer values of a match result as "matched"

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

Status:
Resolved
Priority:
Should have
Assignee:
Category:
MVC
Start date:
2010-05-19
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
Complexity:

Description

The DynamicRoutPart::match() method doesn't do strict comparison of the route's return value and therefore wrongly interprets integer values such as "-1" as TRUE. This leads to the route part handlers to match although they don't.

#1

Updated by Robert Lemke almost 11 years ago

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

Applied in changeset r4321.

#2

Updated by Bastian Waidelich almost 11 years ago

Robert Lemke wrote:

Hi, I have a little remark here:

The DynamicRoutPart::match() [...] wrongly interprets integer values such as "-1" as TRUE.

RoutePartHandler must implement F3\FLOW3\MVC\Web\Routing\RoutePartInterface. It's match() method should always return a boolean (and the default DynamicRoutPart does).
So if DynamicRoutPart::match() returns "-1", that is actually a mistake in the respective route part handler. The same thing for Route:matches(). But I guess, we still want to "fix" this in the calling code, right?

BTW: the fix isn't covered by a unit test ;) should I provide one?

Also available in: Atom PDF