Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Routing issue - bad args in function call. #672

Closed
nowackipawel opened this issue Aug 9, 2017 · 3 comments
Closed

Routing issue - bad args in function call. #672

nowackipawel opened this issue Aug 9, 2017 · 3 comments

Comments

@nowackipawel
Copy link
Contributor

I defined routing like this:

$routes->get('/objects/(:Dalphanum)/sort/(:Dalphanum)/([A-Z]{3,7})', 'AdminList::objectsSortCreate/$1/$2/$3', ['subdomain' => 'adm']);

where Dalphanum is:
$routes->addPlaceholder('Dalphanum', '([0-9a-zA-Z_\-\.]+)');

And
var_dump(func_get_args());

which is inside objectsSortCreate method prints:

array(3) { [0]=> string(6) "someth" [1]=> string(6) "someth" [2]=> string(3) "FOO" }

when I'm trying to open:

https://adm.dmvoneway.com/objects/someth/sort/FOO/BAR

when I changed route for:

$routes->get('/objects/(:Dalphanum)/sort/(:Dalphanum)/([A-Z]{3,7})', 'AdminList::objectsSortCreate/$1/$2/$3/$4/$5', ['subdomain' => 'adm']);

var_dump prints:

array(5) { [0]=> string(6) "someth" [1]=> string(6) "someth" [2]=> string(3) "FOO" [3]=> string(3) "FOO" [4]=> string(3) "BAR" }

I'm not sure if should be:

[0] => someth
[1] => sort
[2] => FOO
[3] => BAR

instead of returning value.

@lonnieezell
Copy link
Member

What is the error you're getting? I'm glad you're trying to debug, but it's easier if you tell us what you expected to happen, and what actually happened so we can see what the problem might be.

@nowackipawel
Copy link
Contributor Author

screenshot-html-online com 2017-08-14 14-09-28

@lonnieezell
Copy link
Member

Sorry it took me so long. I've added a new test for this that replicates it about as closely as I can, and the tests pass with the expected parameters.

Your regex pattern looks fine at a glance.

I'm not sure why it's showing that like it is, but I expect if you set your parameters you expect in your method it should be fine:

public function objectsSortCreate($object, $sort, $key)
{
    . . .
} 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants