[GH-ISSUE #6] search-function: $query is url encoded two times #6

Closed
opened 2026-02-27 19:25:35 +03:00 by kerem · 1 comment
Owner

Originally created by @steinm6 on GitHub (Jul 20, 2014).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/6

Hi,

The following call results in an empty list:

$tracks = SpotifyWebAPI\SpotifyWebAPI::search('Song 2', 'track');

I think this is because the function _search_ in class _SpotifyWebAPI_ calls rawurlencode on the _$query_-variable ('Song 2' gets 'Song%202').

The static function _send_ of class _Request_ uses php-function _http_build_query_ which also urlencodes the given values ('Song%202' gets 'Song%25202').

I removed the rawurlencode in _search_ to avoid that. I am not sure if this is a bug in your lib or a problem with my environment / setup (I am using your lib as part of a Laravel4 project with php 5.5). 😄

Originally created by @steinm6 on GitHub (Jul 20, 2014). Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/6 Hi, The following call results in an empty list: ``` php $tracks = SpotifyWebAPI\SpotifyWebAPI::search('Song 2', 'track'); ``` I think this is because the function **_search**_ in class **_SpotifyWebAPI**_ calls rawurlencode on the **_$query**_-variable ('Song 2' gets 'Song%202'). The static function **_send**_ of class **_Request**_ uses php-function **_http_build_query**_ which also urlencodes the given values ('Song%202' gets 'Song%25202'). I removed the rawurlencode in **_search**_ to avoid that. I am not sure if this is a bug in your lib or a problem with my environment / setup (I am using your lib as part of a Laravel4 project with php 5.5). :smile:
kerem 2026-02-27 19:25:35 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@jwilsson commented on GitHub (Jul 24, 2014):

Hi,
I think you're absolutely right. Mind sending a pull request for it?

Let me just update the tests since they should have caught this.

<!-- gh-comment-id:49980590 --> @jwilsson commented on GitHub (Jul 24, 2014): Hi, I think you're absolutely right. Mind sending a pull request for it? Let me just update the tests since they should have caught this.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotify-web-api-php#6
No description provided.