Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
Fix toolbar load when GET params are present in "_wdt" route#32437
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
When using a custom router that inject GET parameters, eg:```# services.yamlparameters: # Replace default url generator service router.options.generator_base_class: Combodo\iTop\Portal\Routing\UrlGenerator```The path generated by the toolbar JS is HTML entity encoded which breaks the JS call (`&` becomes `&`).
derrabus commentedJul 8, 2019
Can you provide a minimal application that reproduces the problem? |
fabpot commentedJul 27, 2019
@Molkobain Can you tell us more about this issue? |
Molkobain commentedJul 27, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hello guys, What do you means by aminimal app? About the issue, we extended the base UrlGenerator to propagate some parameters to all generated URLs as you will see on the code snippet below. It works fine in the application, URLs are generated as expected. <?phpnamespaceCombodo\iTop\Portal\Routing;useutils;useSymfony\Component\Routing\Generator\UrlGeneratorasBaseUrlGenerator;class UrlGeneratorextends BaseUrlGenerator{protectedfunctiondoGenerate($variables,$defaults,$requirements,$tokens,$parameters,$name,$referenceType,$hostTokens,array$requiredSchemes =array()){$parameters =$this->getExtraParams($parameters);returnparent::doGenerate($variables,$defaults,$requirements,$tokens,$parameters,$name,$referenceType,$hostTokens,$requiredSchemes);}privatefunctiongetExtraParams($aParameters){$sExecModule = utils::ReadParam('exec_module','',false,'string');$sExecPage = utils::ReadParam('exec_page','',false,'string');if ($sExecModule !=='' &&$sExecPage !==''){$aParameters['exec_module'] =$sExecModule;$aParameters['exec_page'] =$sExecPage;}// Optional parameters$sPortalId = utils::ReadParam('portal_id','',false,'string');if ($sPortalId !==''){$aParameters['portal_id'] =$sPortalId;}$sEnvSwitch = utils::ReadParam('env_switch','',false,'string');if ($sEnvSwitch !==''){$aParameters['env_switch'] =$sEnvSwitch;}$sDebug = utils::ReadParam('debug','',false,'string');if ($sDebug !==''){$aParameters['debug'] =$sDebug;}return$aParameters;}} The problem comes with the webprofiler in the webpage, when it tries to connect with the backend through XHR, the URL it calls is HTML entity encoded (check the "&"): The backend then cannot decode the parameters and returns an error. Edit: Pressed Alt+Enter by mistake. I'm completing the comment and poking you when its complete. Sorry |
Molkobain commentedJul 27, 2019
fabpot commentedSep 27, 2019
Thank you@Molkobain. |
…te (Molkobain)This PR was merged into the 3.4 branch.Discussion----------Fix toolbar load when GET params are present in "_wdt" routeWhen using a custom router that inject GET parameters, eg:```# services.yamlparameters: # Replace default url generator service router.options.generator_base_class: Combodo\iTop\Portal\Routing\UrlGenerator```The path generated by the toolbar JS is HTML entity encoded which breaks the JS call (`&` becomes `&`).| Q | A| ------------- | ---| Branch? | 4.4 for features / 3.4, 4.2 or 4.3 for bug fixes <!-- see below -->| Bug fix? | yes| New feature? | no <!-- please update src/**/CHANGELOG.md files -->| BC breaks? | no <!-- seehttps://symfony.com/bc -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tests pass? | yes <!-- please add some, will be required by reviewers -->| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->| License | MIT| Doc PR | symfony/symfony-docs#... <!-- required for new features --><!--Replace this notice by a short README for your feature/bugfix. This will help peopleunderstand your PR and can be used as a start for the documentation.Additionally (seehttps://symfony.com/roadmap): - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too). - Features and deprecations must be submitted against branch 4.4. - Legacy code removals go to the master branch.-->Commits-------5309e64 Fix toolbar load when GET params are present in "_wdt" route
Uh oh!
There was an error while loading.Please reload this page.
When using a custom router that inject GET parameters, eg:
The path generated by the toolbar JS is HTML entity encoded which breaks the JS call (
&becomes&).