[GH-ISSUE #176] getTrack Fatal Error with Partial Track #115

Closed
opened 2026-02-27 19:26:09 +03:00 by kerem · 2 comments
Owner

Originally created by @thejames76 on GitHub (Nov 21, 2019).
Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/176

I'm mucking about with the wrapper and found that a partial getTrack call is resulting in a Fatal Error. I was expecting a FALSE condition being returned. Is this expected?

Using a full / complete track ID returns the Track's object as expected.

To test I ran this:

$sid = $api->getTrack("fjdkfds");

Fatal error: Uncaught SpotifyWebAPI\SpotifyWebAPIException: invalid id in /spotify/vendor/jwilsson/spotify-web-api-php/src/Request.php:40 Stack trace: #0 /spotify/vendor/jwilsson/spotify-web-api-php/src/Request.php(242): SpotifyWebAPI\Request->parseBody(Object(stdClass), 400) #1 /spotify/vendor/jwilsson/spotify-web-api-php/src/Request.php(121): SpotifyWebAPI\Request->send('GET', 'https://api.spo...', '', Array) #2 /spotify/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php(72): SpotifyWebAPI\Request->api('GET', '/v1/tracks/*fds...', Array, Array) #3 /spotify/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php(83): SpotifyWebAPI\SpotifyWebAPI->sendRequest('GET', '/v1/tracks/*fds...', Array, Array) #4 /spotify/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php(1278): SpotifyWebAPI\SpotifyWebAPI->sendRequest('GET', '/v1/tracks/*fds...', Array, Ar in /spotify/vendor/jwilsson/spotify-web-api-php/src/Request.php on line 40

Originally created by @thejames76 on GitHub (Nov 21, 2019). Original GitHub issue: https://github.com/jwilsson/spotify-web-api-php/issues/176 I'm mucking about with the wrapper and found that a partial getTrack call is resulting in a Fatal Error. I was expecting a FALSE condition being returned. Is this expected? Using a full / complete track ID returns the Track's object as expected. To test I ran this: `$sid = $api->getTrack("fjdkfds");` Fatal error: Uncaught SpotifyWebAPI\SpotifyWebAPIException: invalid id in <REMOVED>/spotify/vendor/jwilsson/spotify-web-api-php/src/Request.php:40 Stack trace: #0 <REMOVED>/spotify/vendor/jwilsson/spotify-web-api-php/src/Request.php(242): SpotifyWebAPI\Request->parseBody(Object(stdClass), 400) #1 <REMOVED>/spotify/vendor/jwilsson/spotify-web-api-php/src/Request.php(121): SpotifyWebAPI\Request->send('GET', 'https://api.spo...', '', Array) #2 <REMOVED>/spotify/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php(72): SpotifyWebAPI\Request->api('GET', '/v1/tracks/*fds...', Array, Array) #3 <REMOVED>/spotify/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php(83): SpotifyWebAPI\SpotifyWebAPI->sendRequest('GET', '/v1/tracks/*fds...', Array, Array) #4 <REMOVED>/spotify/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php(1278): SpotifyWebAPI\SpotifyWebAPI->sendRequest('GET', '/v1/tracks/*fds...', Array, Ar in <REMOVED>/spotify/vendor/jwilsson/spotify-web-api-php/src/Request.php on line 40
kerem closed this issue 2026-02-27 19:26:09 +03:00
Author
Owner

@jwilsson commented on GitHub (Nov 22, 2019):

Hi!
Yes, that's expected because Spotify returns an error response which is then converted to a PHP exception. Nothing is currently done to differentiate between different kinds of errors.

<!-- gh-comment-id:557410352 --> @jwilsson commented on GitHub (Nov 22, 2019): Hi! Yes, that's expected because Spotify returns an error response which is then converted to a PHP exception. Nothing is currently done to differentiate between different kinds of errors.
Author
Owner

@thejames76 commented on GitHub (Nov 22, 2019):

okay, thanks for the info. <3

<!-- gh-comment-id:557517827 --> @thejames76 commented on GitHub (Nov 22, 2019): okay, thanks for the info. <3
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#115
No description provided.