-
Notifications
You must be signed in to change notification settings - Fork 206
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
fix EZP21591: querystring lost in redirection #527
Conversation
+1 |
+1 (but nitpick, what is "Carrier" in this context? better with just $querystring or something ?) |
it's what the variable is for, it "carries" the querystring over the redirect op. |
@@ -137,6 +137,7 @@ public function onKernelRequestRedirect( GetResponseEvent $event ) | |||
{ | |||
$siteaccess = $request->attributes->get( 'siteaccess' ); | |||
$semanticPathinfo = $request->attributes->get( 'semanticPathinfo' ); | |||
$querystring = $request->getQueryString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CS: $queryString in camel caps.
But better would be to just not use a temporary variable and write directly:
$semanticPathinfo . '?' . $request->getQueryString()
to keep the context closer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're forced to use a temp variable here (for keeping readability). And it makes me thing that we don't have always a query string while we enforce it below.
+1 but take other's remark into account. |
@@ -148,7 +149,7 @@ public function onKernelRequestRedirect( GetResponseEvent $event ) | |||
|
|||
$event->setResponse( | |||
new RedirectResponse( | |||
$semanticPathinfo, | |||
$semanticPathinfo . '?' . $querystring, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if $queryString
is empty ? We'll have an orphan ?
.
Better do something like this:
$queryString = $request->getQueryString();
// ...
new RedirectResponse ( $semanticPathinfo . $queryString ? "?$queryString" : '' );
This Pull Request does not respect our Coding Standards, please, see the report below:
|
good to go? |
You have 3 "+1" so yes it is ok. |
Manually merged in 9a70edc |
will carry the querystring params on a redirect operation.
the QueryString is normalized by the request(), so i needed to manually add the '?' for the the fix to work. yes, looks ugly, is there a better way to do it?