Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

RuntimeException Layer and request path have gone out of sync for capitalised piped route #168

Closed
jakeBarwell opened this issue Apr 14, 2018 · 3 comments

Comments

@jakeBarwell
Copy link

jakeBarwell commented Apr 14, 2018

Getting a RuntimeException
"Layer and request path have gone out of sync"
From zendframework/zend-stratigility/src/Next.php line 271

Code to reproduce the issue

Add piped route like this for example
$app->pipe('/myadmin', \App\Middleware\Auth\AdminAuth::class);

Then via browser go to /MYADMIN
(Note the capital letters)

Expected results

Either 404 or it matches that route

Actual results

RuntimeException
"Layer and request path have gone out of sync"

@jakeBarwell
Copy link
Author

jakeBarwell commented Apr 15, 2018

Sorry that was on version 2.1.2 just upgraded to 2.2.1 and similar behaviour

Exception\PathOutOfSyncException thrown from src/Middleware/PathMiddlewareDecorator.php line 128

Looking at master branch, I do not think this will still be an issue.

weierophinney added a commit to weierophinney/zend-stratigility that referenced this issue Apr 16, 2018
In zendframework#168, we received a report indicating that path matching within
`PathMiddlewareDecorator` fails if the path is the same, but using a
different case.

Interestingly, we _match_ it correctly; the problem is when _preparing
the truncated path_ to pass on to the decorated middleware, as it cannot
identify the matched segment correctly.

This patch modifies the logic in `getTruncatedPath()` to do a
case-insensitive comparison of the segment and the path in the initial
condition.
@weierophinney
Copy link
Member

Fixed with #169 and new 2.2.2 release; I'm preparing a patch for the 3.0 series as well.

weierophinney added a commit to weierophinney/zend-stratigility that referenced this issue Apr 16, 2018
In zendframework#168, we received a report indicating that path matching within
`PathMiddlewareDecorator` fails if the path is the same, but using a
different case.

This patch forward-ports the test from patch 44f8885 to the 3.0 series;
the 3.0 series was already working correctly.
@weierophinney
Copy link
Member

The patch prepared for master, #170, only includes the unit test, as the behavior was already correct in that branch.

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

No branches or pull requests

2 participants