Repository: LycheeOrg/Lychee (language: php)

Issue:
Error while setting a favorite photo by context menu
### Detailed description of the problem [REQUIRED]
When trying to add a photo to favorites by right clicking it, the following Symfony error is shown : 

```text
App\Policies\PhotoPolicy::canEditById(): Argument #2 ($photoIDs) must be of type array, string given, called in /var/www/html/Lychee/vendor/laravel/framework/src/Illuminate/Auth/Access/Gate.php on line 811
```

### Steps to reproduce the issue
**Steps to reproduce the behavior:**
1. Go to an album
2. Right click on a photo
3. Click on "favorite"
4. See error:

![image](https://github.com/LycheeOrg/Lychee/assets/38006711/23e2f695-f0d3-431a-bb00-a8d1062fe58e)

### Output of the diagnostics  [REQUIRED]
*(Settings => Diagnostics or https://example.com/Diagnostics or `php artisan lychee:diagnostics`)*


```text
    Diagnostics
    -----------
        Warning: Dropbox import not working. dropbox_key is empty.
        Warning: zend.assertions is disabled although Lychee is in debug mode. For easier debugging code generation for assertions should be enabled.
        Error: APP_URL (https://photos************uen.fr) does not match the current url (http://photos************uen.fr).
               This will break WebAuthn authentication.
        Error: APP_URL (https://photos************uen.fr) does not match the current url (http://photos************uen.fr).
               This will prevent images from being properly displayed.
        Info: Latest version of PHP is 8.3
        Warning: git (software) is not available.

    System Information
    ------------------
        Lychee Version (git):                    ?? (b8ace78) -- Could not compare.
        DB Version:                              5.0.3
        
        composer install:                        --no-dev
        APP_ENV:                                 production
        APP_DEBUG:                               true
        APP_URL:                                 set
        APP_DIR:                                 default
        LOG_VIEWER_ENABLED:                      true
        LIVEWIRE_ENABLED:                        true
        
        System:                                  Linux
        PHP Version:                             8.2.7
        PHP User agent:                          Lychee/4 (https://lycheeorg.github.io/)
        Timezone:                                Europe/Paris
        Max uploaded file size:                  100M
        Max post size:                           100M
        Livewire chunk size:                     12.00 MB
        Max execution time:                      3600
        PostgreSQL Version:                      PostgreSQL 16.1 on x86_64-pc-linux-musl, compiled by gcc (Alpine 12.2.1_git20220924-r10) 12.2.1 20220924, 64-bit
        
        exec() Available:                        yes
        Imagick Available:                       1
        Imagick Enabled:                         1
        Imagick Version:                         1691
        GD Version:                              2.3.3
        Number of foreign key:                   11 found.
     

    Config Information
    ------------------
        version:                                 050003
        check_for_updates:                       0
        sorting_photos_col:                      taken_at
        sorting_photos_order:                    ASC
        sorting_albums_col:                      title
        sorting_albums_order:                    ASC
        imagick:                                 1
        skip_duplicates:                         0
        small_max_width:                         0
        small_max_height:                        360
        medium_max_width:                        1920
        medium_max_height:                       1080
        lang:                                    fr
        image_overlay_type:                      desc
        default_license:                         reserved
        compression_quality:                     90
        grants_full_photo_access:                1
        delete_imported:                         0
        mod_frame_enabled:                       1
        mod_frame_refresh:                       30
        thumb_2x:                                1
        small_2x:                                1
        medium_2x:                               1
        landing_page_enable:                     1
        site_owner:                              Lilian POULIQUEN
        landing_title:                           Home-Pouliquen Photos
        landing_subtitle:                        Un cloud c'est bien, chez soi c'est mieux !
        sm_facebook_url:                         
        sm_flickr_url:                           
        sm_twitter_url:                          
        sm_instagram_url:                        
        sm_youtube_url:                          
        landing_background:                      dist/cat.webp
        site_title:                              Home-Pouliquen Photos
        footer_show_copyright:                   1
        site_copyright_begin:                    2021
        site_copyright_end:                      2023
        footer_additional_text:                  
        footer_show_social_media:                0
        search_public:                           0
        SL_enable:                               0
        SL_for_admin:                            0
        recent_age:                              1
        grants_download:                         1
        photos_wraparound:                       1
        map_display:                             0
        zip64:                                   1
        map_display_public:                      0
        map_provider:                            Wikimedia
        force_32bit_ids:                         0
        map_include_subalbums:                   0
        update_check_every_days:                 3
        has_exiftool:                            1
        share_button_visible:                    0
        import_via_symlink:                      0
        has_ffmpeg:                              1
        location_decoding:                       0
        location_decoding_timeout:               30
        location_show:                           1
        location_show_public:                    0
        rss_enable:                              0
        rss_recent_days:                         7
        rss_max_items:                           100
        prefer_available_xmp_metadata:           0
        editor_enabled:                          1
        lossless_optimization:                   0
        swipe_tolerance_x:                       150
        swipe_tolerance_y:                       250
        local_takestamp_video_formats:           .avi|.mov
        log_max_num_line:                        1000
        unlock_password_photos_with_url_param:   0
        nsfw_visible:                            1
        nsfw_blur:                               0
        nsfw_warning:                            0
        nsfw_warning_admin:                      0
        nsfw_banner_override:                    
        map_display_direction:                   1
        album_subtitle_type:                     oldstyle
        upload_processing_limit:                 4
        new_photos_notification:                 0
        legacy_id_redirection:                   1
        zip_deflate_level:                       6
        SA_enabled:                              1
        default_album_protection:                1
        album_decoration:                        layers
        album_decoration_orientation:            row
        allow_username_change:                   1
        auto_fix_orientation:                    1
        use_job_queues:                          0
        random_album_id:                         starred
        use_last_modified_date_when_no_exif_date: 0
        ffmpeg_path:                             /usr/bin/ffmpeg
        ffprobe_path:                            /usr/bin/ffprobe
        layout:                                  justified
        date_format_photo_thumb:                 M j, Y, g:i:s A e
        date_format_photo_overlay:               M j, Y, g:i:s A e
        date_format_sidebar_uploaded:            M j, Y, g:i:s A e
        date_format_sidebar_taken_at:            M j, Y, g:i:s A e
        date_format_hero_min_max:                F Y
        date_format_hero_created_at:             M j, Y, g:i:s A T
        date_format_album_thumb:                 M Y
        upload_chunk_size:                       0
        nsfw_banner_blur_backdrop:               0
        search_pagination_limit:                 1000
        search_minimum_length_required:          4
        photo_layout_justified_row_height:       320
        photo_layout_masonry_column_width:       300
        photo_layout_grid_column_width:          250
        photo_layout_square_column_width:        200
        photo_layout_gap:                        12
        display_thumb_album_overlay:             always
        display_thumb_photo_overlay:             hover
        default_album_thumb_aspect_ratio:        1/1
        use_album_compact_header:                0
        login_button_position:                   left
        back_button_enabled:                     0
        back_button_text:                        Return to Home
        back_button_url:                         /
```

### Browser and system

Client:
Firefox 121 on Fedora 39

Server:
Alpine 3.18
Lychee Docker 5.0.3


Discussion / hints:

Fix patch:
diff --git a/app/Livewire/Components/Menus/PhotoDropdown.php b/app/Livewire/Components/Menus/PhotoDropdown.php
index 86c5488653e..445820e65f0 100644
--- a/app/Livewire/Components/Menus/PhotoDropdown.php
+++ b/app/Livewire/Components/Menus/PhotoDropdown.php
@@ -55,7 +55,7 @@ public function render(): View
 	public function star(): void
 	{
 		$this->closeContextMenu();
-		Gate::authorize(PhotoPolicy::CAN_EDIT_ID, [Photo::class, $this->params[Params::PHOTO_ID]]);
+		Gate::authorize(PhotoPolicy::CAN_EDIT_ID, [Photo::class, [$this->params[Params::PHOTO_ID]]]);
 		Photo::where('id', '=', $this->params[Params::PHOTO_ID])->update(['is_starred' => true]);
 		$this->dispatch('reloadPage')->to(GalleryAlbum::class);
 	}
@@ -63,7 +63,7 @@ public function star(): void
 	public function unstar(): void
 	{
 		$this->closeContextMenu();
-		Gate::authorize(PhotoPolicy::CAN_EDIT_ID, [Photo::class, $this->params[Params::PHOTO_ID]]);
+		Gate::authorize(PhotoPolicy::CAN_EDIT_ID, [Photo::class, [$this->params[Params::PHOTO_ID]]]);
 		Photo::where('id', '=', $this->params[Params::PHOTO_ID])->update(['is_starred' => false]);
 		$this->dispatch('reloadPage')->to(GalleryAlbum::class);
 	}


Test patch: