Bug #7831

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

Added by Robert Lemke over 11 years ago. Updated about 11 years ago.

Should have
Start date:
Due date:
% Done:


Estimated time:
PHP Version:
Has patch:


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.


Updated by Robert Lemke over 11 years ago

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

Applied in changeset r4321.


Updated by Bastian Waidelich over 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