PHP Classes

Error matching routes

Recommend this page to a friend!

      Simple Framework  >  All threads  >  Error matching routes  >  (Un) Subscribe thread alerts  
Subject:Error matching routes
Summary:public function match() in Router.php
Author:Dennis Ampere
Date:2015-09-03 12:21:35

  1. Error matching routes   Reply   Report abuse  
Picture of Dennis Ampere Dennis Ampere - 2015-09-03 12:21:35
In the public function match() in Router.php, i found out that the condition,

if(preg_match($ruta, $this->_path) && $this->_method == $method){} will always evaluate to false if a method is called within the url and will always fall on the default_404 not found controller.


if you define a new method in demo controller (demo.php) like

public function test() {}

and try calling "localhost/slaveframework/demo/test", it will not work because the if condition will evaluate to false since

preg_match($ruta, $this->_path) will look like preg_match('/^demo$/', 'demo/test') and this function will return false and the whole if statement will evaluate to false.

Please how do we check this?