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

Decode URL so that no % signs are passed to sprintf #355

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shaedrich
Copy link

@shaedrich shaedrich commented Aug 19, 2021

Context

When you have an url like this:
https://example.com/users?filter%5B0%5D%5Bhidden_infos%5D=&filter%5B0%5D%5Bstatus%5D%5Bis_parked%5D=0&filter%5B0%5D%5Bstatus%5D%5Bis_cancelled%5D=0&filter%5B0%5D%5Bstatus%5D%5Bis_paid%5D=1&filter%5B0%5D%5Bplatform%5D%5Boperator%5D=%21%3D&filter%5B0%5D%5Bplatform%5D%5Bvalue%5D=Amazon-Shop&filter%5B0%5D%5Binfos%5D%5Boperator%5D=%21%7E&filter%5B0%5D%5Binfos%5D%5Bvalue%5D=%2AAmazon+Prime%2A&filter%5B1%5D%5Bhidden_infos%5D=&filter%5B1%5D%5Bstatus%5D%5Bis_parked%5D=0&filter%5B1%5D%5Bstatus%5D%5Bis_cancelled%5D=0&filter%5B1%5D%5Bpayment_method_id%5D%5B0%5D=COD&filter%5B1%5D%5Bpayment_method_id%5D%5B1%5D=OnAccount&filter%5B1%5D%5Bpayment_method_id%5D%5B2%5D=hui&filter%5B1%5D%5Bpayment_method_id%5D%5B3%5D=hp_bs&filter%5B1%5D%5Bpayment_method_id%5D%5B4%5D=hp_ivpg&filter%5B2%5D%5Bhidden_infos%5D=&filter%5B2%5D%5Bstatus%5D%5Bis_parked%5D=0&filter%5B2%5D%5Bstatus%5D%5Bis_cancelled%5D=0&filter%5B2%5D%5Bstatus%5D%5Bis_paid%5D=1&filter%5B2%5D%5Bstatus%5D%5Bis_packed%5D=1&filter%5B2%5D%5Bplatform%5D=Amazon-Shop&filter%5B2%5D%5Binfos%5D%5Boperator%5D=%7E&filter%5B2%5D%5Binfos%5D%5Bvalue%5D=%2AAmazon+Prime%2A&select%5Bno_history%5D=1&select%5Bid%5D=&select%5Bdate%5D=&select%5Bportal_account_id%5D=&select%5Bplatform%5D=&select%5Binvoice_number%5D=&select%5Bexternal_order_id%5D=&select%5Bcurrent_date%5D=&select%5Bcustomer%5D=&select%5Bshipping%5D%5Bfee%5D=&select%5Bshipping%5D%5Bdate%5D=&select%5Bshipping%5D%5Bdeliverer%5D=&select%5Bshipping%5D%5Bcode%5D=&select%5Bshipping%5D%5Bmethod%5D=&select%5Bshipping%5D%5Baddress%5D=&select%5Bshipping%5D%5Bprime_label%5D=&select%5Bshipping%5D%5Bplatform_status%5D=&select%5Bline%5D=&select%5Bstatus%5D=&select%5Binvoice_amount%5D=&select%5Bpaid_amount%5D=&select%5Bcurrency_id%5D=&select%5Bpayment_method_id%5D=&select%5Bpack_infos%5D=&select%5Binfos%5D=&select%5Bbill_url%5D=&select%5Badd_field%5D=&select%5Bhidden_infos%5D=&select%5Bcredit%5D=&pagination%5Bmin_id%5D=0_2021_7&pagination%5Blimit%5D=200

sprintf() in beberlei/assert/lib/Assert/Assertion.php on line 1149 throws:

Unknown format specifier "B"

That is because encoded url parts (starting with %) are mistaken for sprintf format specifiers (also starting with %)

What has been done

  • wrapped $request->getUrl() in urldecode() in HttpClient::send() before passing it to Assertion::isResource()

How to test

  • Call Assertion::isResource($ch, "Could not init curl with URL '{$request->getUrl()}'") with the given URL above

Todo

Notes

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.

None yet

1 participant