OSDN Git Service

Try to load class constructor when method name is not set or empty
authorAntoine Pous <antoine@pous.so>
Sun, 18 Oct 2015 07:38:27 +0000 (09:38 +0200)
committerAntoine Pous <antoine@pous.so>
Sun, 18 Oct 2015 07:38:27 +0000 (09:38 +0200)
src/PHPRouter/Route.php

index 2153cee..e6012fd 100755 (executable)
@@ -169,6 +169,10 @@ class Route
             $this->parameters = array($this->parameters);
         }
 
+        if(empty($action[1]) || trim($action[1]) == '') {
+          $action[1] = '__construct';
+        }
+
         call_user_func_array(array($instance, $action[1]), $this->parameters);
     }
 }