PHPoAuthLib icon indicating copy to clipboard operation
PHPoAuthLib copied to clipboard

Failure to generate correct signature with array style query params

Open orukusaki opened this issue 9 years ago • 2 comments

PHP 5.5.15 (cli) (built: Jul 31 2014 13:41:26) OSX

Signatures are not generated correctly when query params are in the array style, using square brackets.

Example (Magento REST api):

api/rest/products?filter[1][attribute]=entity_id&filter[1][neq]=3

A Warning is issued:

PHP Warning:  rawurlencode() expects parameter 1 to be string, array given in ... OAuth1/Signature/Signature.php on line 63

And the resulting signature is incorrect.

The reason is that parse_str() (Signature.php#59) will unpack the query into a multidimensional array, whereas the following code is expecting each item to be a string.

orukusaki avatar Mar 02 '15 16:03 orukusaki

Can you reproduce the error on my fork?

logical-and avatar Apr 05 '15 16:04 logical-and

https://github.com/Dragonqos/PHPoAuthLib/commit/8c6f1afb649217ae4dbadb8288a207d7da9ef740 this commit may help to resolve issue

Dragonqos avatar Feb 27 '17 23:02 Dragonqos