Permalink
Browse files

avoid offset -1 error on tests etc

  • Loading branch information...
1 parent 972d575 commit 2cff67184fdc135045d294b1e8e8d50147674f9c @dereuromark dereuromark committed Oct 9, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 lib/Cake/Routing/Router.php
@@ -633,8 +633,8 @@ public static function getRequest($current = false) {
* @return array Parameter information
*/
public static function getParams($current = false) {
- if ($current) {
- return self::$_requests[count(self::$_requests) - 1]->params;
+ if ($current && ($count = count(self::$_requests)) > 0) {
+ return self::$_requests[$count - 1]->params;
}
if (isset(self::$_requests[0])) {
return self::$_requests[0]->params;

0 comments on commit 2cff671

Please sign in to comment.