jwilsson/spotify-web-api-php

SpotifyWebAPI\SpotifyWebAPI->followPlaylist() Uncaught TypeError

zwisler opened this issue · 1 comments

If i Use a sting i get this error

Fatal error: Uncaught TypeError: SpotifyWebAPI\SpotifyWebAPI::sendRequest(): Argument #3 ($parameters) must be of type array|string, null given, called in /homepages/34/d680223326/htdocs/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php on line 626 and defined in /homepages/34/d680223326/htdocs/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php:109 Stack trace: #0 /homepages/34/d680223326/htdocs/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php(626): SpotifyWebAPI\SpotifyWebAPI->sendRequest() #1 /homepages/34/d680223326/htdocs/vendor/CitWebApi/CitaurusWebAPI.php(1304): SpotifyWebAPI\SpotifyWebAPI->followPlaylist() #2 /homepages/34/d680223326/htdocs/SongSubmit.php(50): CitaurusMusicWebAPI->FollowPlaylists() #3 {main} thrown in /homepages/34/d680223326/htdocs/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php on line 109

If i Use a string arry i get this Error

Fatal error: Uncaught TypeError: SpotifyWebAPI\SpotifyWebAPI::followPlaylist(): Argument #1 ($playlistId) must be of type string, array given, called in /homepages/34/d680223326/htdocs/vendor/CitWebApi/CitaurusWebAPI.php on line 1305 and defined in /homepages/34/d680223326/htdocs/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php:614 Stack trace: #0 /homepages/34/d680223326/htdocs/vendor/CitWebApi/CitaurusWebAPI.php(1305): SpotifyWebAPI\SpotifyWebAPI->followPlaylist() #1 /homepages/34/d680223326/htdocs/SongSubmit.php(50): CitaurusMusicWebAPI->FollowPlaylists() #2 {main} thrown in /homepages/34/d680223326/htdocs/vendor/jwilsson/spotify-web-api-php/src/SpotifyWebAPI.php on line 614

`Public function FollowPlaylists(string $PLid ): bool{
		 $myret = false;
		$p = array($PLid);
		
        if ($this->go){		 
		 try {
			 //$myret =  $this->api->followPlaylist($PLid); //using in case 1
			 $myret =  $this->api->followPlaylist($p); //using in case 2
		 }catch (Exception $e) {
				// allgemeiner Fehler			  
			  $this->response .= $e->getMessage();		  
		  }
		}
		  return $myret;
	 }`

Hey!
You should pass a string like you're doing in case 1. But it looks like I missed a place when adding type definitions a while back. So the error is an internal one, I'll get a patch published.