Decode URL so that no % signs are passed to sprintf #355
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:That is because encoded url parts (starting with
%
) are mistaken for sprintf format specifiers (also starting with%
)What has been done
$request->getUrl()
inurldecode()
inHttpClient::send()
before passing it toAssertion::isResource()
How to test
Assertion::isResource($ch, "Could not init curl with URL '{$request->getUrl()}'")
with the given URL aboveTodo
Notes