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

Throw error if required route params missing #3118

Merged
merged 6 commits into from
Oct 23, 2021

Conversation

askvortsov1
Copy link
Sponsor Member

Fixes #2513

Changes proposed in this pull request:

  • Throw an explicit exception if a required path argument is missing when generating URls
  • Restructure fixPathPart method to be clearer
  • Call fixPathPart functionally via array_map` instead of using pass-by-reference to update the part magically.
  • Add tests to ensure proper behavior for required and optional parameters.

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

@askvortsov1 askvortsov1 merged commit 87f6774 into master Oct 23, 2021
@askvortsov1 askvortsov1 deleted the dk/2513-safeguard-missing-route-params branch October 23, 2021 18:05
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

Successfully merging this pull request may close these issues.

RouteCollection::getPath() throws Array to string conversion instead of proper error when parameter is missing
4 participants