Optional/boolean route parameters not matched #18

Open
kevmo314 opened this Issue Jan 29, 2012 · 0 comments

Comments

Projects
None yet
1 participant

I have an admin route and sometimes the admin param isn't specified (admin = null vs admin = true) in the route. With AuthRbac, this causes an issue when parsing the match. My fix is as follows but I haven't thoroughly tested it:

Line 147 AuthRbac.php, change

        if (!$exists_in_request || $value !== Inflector::underscore($request->params[$type])) {
            return false;
        }

to:

        if($value == null && !$exists_in_request) {
          continue;
        }
        if(!$exists_in_request || $value !== (is_string($request->params[$type]) ? Inflector::underscore($request->params[$type]) : $request->params[$type])) {
          return false;
        }

I didn't create a pull request because I also want to verify that there isn't an alternate way of doing this that I haven't realized?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment