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

Resource metadata for URIs when mount() is used. Some preg_match issue fixes #137

Open
ivolator opened this issue May 1, 2013 · 3 comments

Comments

@ivolator
Copy link

ivolator commented May 1, 2013

Hello,
Here are couple of bugs i needed to fix in the instance I am running. Those bugs seem to be present in the latest code too.

When setting the Lines 109 and 240 there is a mismatch with the 'uri parameter.
Line 109 should be $this->resources[$className]['uri'][] = ....
Line 240 should be $metadata['uri'][] = ....

On that note I notice that there is a call to loadResourceMetadata() in the __construct() and the baseUri is not being passed.

On line 43: doing this $this->loadResourceMetadata($this->baseUri); instead of $this->loadResourceMetadata(); correctly allows you to set relative URIs in the resources.

On an improvement note (also fixing another bug):
The addition of '|^' and '$|' causes preg_match to issue a warning for URIs where '|^' is missing.
Suggested fix here is to not append the former delimiter strings at lines 90 and 109, but instead do it on line 181 preg_match('|^' . $uriRegex . '$|' , $request->uri, $params).
This would make it easier to read and avoid doing the substr() ...

Thanks!

@peej
Copy link
Owner

peej commented May 1, 2013

Hi ivolator,

Thanks for reporting these issues.

Not knowing what is causing the problem, it's not possible for me to test what effects the uri parameter amends have. Do you think you could update the mounting.feature Behat feature to test these cases?

The adjustment of the uri regexp is a great improvement, thanks.

@ivolator
Copy link
Author

ivolator commented May 2, 2013

Sure. I'll find the time during the weekend to setup environment.
Regards!

@peej
Copy link
Owner

peej commented May 26, 2013

Hi @ivolator, did you get anywhere with this? If not, can you provide an example of the code that causes the issue?

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