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

Allow nested query parameters to be parsed with build_query #2106

Closed
morloderex opened this issue Jul 15, 2018 · 3 comments
Closed

Allow nested query parameters to be parsed with build_query #2106

morloderex opened this issue Jul 15, 2018 · 3 comments
Labels

Comments

@morloderex
Copy link

morloderex commented Jul 15, 2018

Q A
Bug? no
New Feature? yes
Version 6.3.0

Actual Behavior

Tyring to build a query string with nested array's fails.

rawurlencode() expects parameter 1 to be string, array given (with encoding on)

without encoding
Array to string conversion

Expected Behavior

I would expect the that the trying to parse a nested array to build_query actually builds the query.

The expected query string should be something like the fallowing (not escaped):

filters[errors.status][][type]=eq&filters[errors.status][][value]=new&filters[error.assigned_to][][type]=ne&filters[error.assigned_to][][value]=12345&auth_token=xxx

Steps to Reproduce

Pass in an array to params array that looks something like the fallowing.

$params parameter

"filters" => array:2 [
    "error.status" => array:1 [
      0 => [
        "type" => "eq"
        "value" => "new"
      ]
    ]
    "error.assigned_to" => [
      0 => [
        "type" => "ne"
        "value" => "12345"
      ]
    ]
  ]
  "auth_token" => "xxx" (removed for security reasons)

Possible Solutions

Use recoursion to build a query like this. But i don't have any implemmentation or pr that i can share just yet.

@morloderex
Copy link
Author

anyone? No?

@sagikazarmark sagikazarmark changed the title [Feature request] Allow nested query parameters to be parsed with build_query Allow nested query parameters to be parsed with build_query Sep 28, 2018
@sagikazarmark
Copy link
Member

You should probably encode the query yourself and pass in a string.

@stale
Copy link

stale bot commented Sep 25, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 2 weeks if no further activity occurs. Thank you for your contributions.

@stale stale bot added the lifecycle/stale No activity for a long time label Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants