Skip to content

Commit 30cde17

Browse files
authored
Check for photoset's has_requested_photos before using
Only photos owned by the user will be returned in has_requested_photos, otherwise the data is left off. This was resulting in the following error: > Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given
1 parent eeff6a7 commit 30cde17

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/PhotosApi.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ public function getSets($photoIds, $userId = null)
474474
}
475475
foreach ($sets['photoset'] as $photoset) {
476476
foreach ($photoIds as $photoId) {
477-
if (in_array($photoId, $photoset['has_requested_photos'])) {
477+
// has_requested_photos is only set if the user owns the photo.
478+
if (in_array($photoId, $photoset['has_requested_photos'] ?? [])) {
478479
$out[] = $photoset;
479480
}
480481
}

0 commit comments

Comments
 (0)