Tustin / psn-php

A PHP wrapper for the PSN API
https://tustin.dev/psn-php/
MIT License
354 stars 73 forks source link

Fatal error using $query = $client->users()->search($id); Offset 128 #251

Open Argosth opened 1 year ago

Argosth commented 1 year ago

Hello,

I'm using the Tustin's PlayStation Network PHP library and running into an issue when I use the search method to retrieve users that match a specific criteria. Here's my current code:

php Copy code $query = $client->users()->search($id); foreach($query as $user) { // processing user information } The search method retrieves over 100 users as expected, but once it reaches a certain point (around the 128th user), it throws the following fatal error:

php Copy code Fatal error: Uncaught InvalidArgumentException: Offset 128 does not exist. in C:\Users...\vendor\tustin\psn-php\src\Iterator\AbstractApiIterator.php:156 Stack trace: #0 C:\Users...\vendor\tustin\psn-php\src\Iterator\UsersSearchIterator.php(73): Tustin\PlayStation\Iterator\AbstractApiIterator->getFromOffset(128) #1 C:\Users\my-file.php(120): Tustin\PlayStation\Iterator\UsersSearchIterator->current() #2 C:...\Argosth\index.php(167): include('C:\Users\\xC3\x93scar...') #3 {main} thrown in C:\Users...\Argosth\vendor\tustin\psn-php\src\Iterator\AbstractApiIterator.php on line 156 I am unsure of why this error is occurring or how to properly handle it. Does anyone have any ideas or suggestions on how to resolve this issue?

Thank you in advance for your help.