prismicio-community / php-kit

Community maintained development kit for Prismic and the PHP language
https://prismic.io
Other
108 stars 82 forks source link

Prismic::SearchForm url parameters are not correctly separated #157

Closed damyanovg closed 1 year ago

damyanovg commented 6 years ago

https://github.com/prismicio/php-kit/blob/5670c79a639c09b96ad9460592713fad3a7f777d/src/Prismic/SearchForm.php#L265

Example options: ['pageSize' => 2, 'page' => 2] they are not separated correctly and the reason the response is incorrect.

With '?' as a separator the url looks like this: ...?page=1&pageSize=100&...

Once the question mark is changed to '&' the parameters are correctly separated: ...&page=1&pageSize=100&...

c0nst4ntin commented 1 year ago

@damyanovg Could you maybe provide me with a little code example of where this problem appeared to you? I am currently trying to go through all the Issues and PRs on this project to attempt to get things back on track.

gsteel commented 1 year ago

If you are using the integration fields feature, your api url will typically already contain query parameters such as …/prismic-endpoint?integration-field-stuff=whatever. This lib just appends ?new-query-params to the configured api url without first checking for an existing query - at least it used to. At the least there needs to be a unit test that covers an api url with pre-configured query params.

c0nst4ntin commented 1 year ago

I'll Look into this a bit more tomorrow. But that was exactly the problem I was seeing as well

c0nst4ntin commented 1 year ago

Whilst there seems to be no automated test for this, it appears to be fixed: https://github.com/prismicio-community/php-kit/blob/master/src/Prismic/Utils.php#L10

Should I try to add a test for this? Or should we just close this issue?

c0nst4ntin commented 1 year ago

I will proceed to mark this as closed for now. If anybody runs into this problem again, please re-open it or start a new issue.