Repository: ampache/ampache (language: php)

Issue:
Some albums are named after the artist and not the album name in 6.2
## Description

### Describe the bug
Some albums show the artist name instead of the actual album names.
I have both 6.1 and 6.2.1 running with the same music files, and this problem is specific to 6.2.
Some albums names are correct and others aren't with no obvious pattern.

### Screenshots

(In the 3rd screenshot, the song edit pop up shows the correct album name, but in the 4th screenshot, it get replaced by the artist instead)

6.1 : 

![2](https://github.com/ampache/ampache/assets/151439279/15818363-82ee-44bb-b3ae-d1dcf9fee537)

![1](https://github.com/ampache/ampache/assets/151439279/f3b8fb79-39dd-46b1-8166-25f5174b9ae2) 



6.2.1 : 

![3](https://github.com/ampache/ampache/assets/151439279/15f258e9-d5e6-4997-80c6-fddf10358d30)

![4](https://github.com/ampache/ampache/assets/151439279/65d459df-eba5-471f-9cbb-5bf82194dce1)



Discussion / hints:
I have exactly the same issue. 
Most of my album names have been replaced with the Artist
It looks like the album names in the database are still Ok.
Is this when editing?
this is an odd one

edit album row gets the simple fullname
![image](https://github.com/ampache/ampache/assets/1305249/9399580b-8de7-492c-8800-a29ae91e504d)

which always pulls name and prefix
![image](https://github.com/ampache/ampache/assets/1305249/9fe8babf-6db6-4652-877e-3ec04073e9c5)

does it log as an album for you when editing?
![image](https://github.com/ampache/ampache/assets/1305249/594c2f41-06b2-41a5-b848-79cab57ae89e)

another thing which pager are you editing from? could be something in one of the templates

Like from the album page? `albums.php?action=show&album=161844`

or the album row from the artist page? `artists.php?action=show&artist=8425`
I have the same issue and I tried to change the album name from both the album page and the artist page but it still says the same album name as the artist.

This is my debug log when clicking "Edit album" from the albm page:

> 2024-01-11T15:47:48+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:47:48+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:47:48+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:47:48+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:47:48+00:00 [superuser] (Ampache\Module\System\Session) -> opetd7larbo6fbfr5sr0uk4u5b has been extended to Thu, 11 Jan 2024 16:47:48 +0000 extension length 3600
2024-01-11T15:47:48+00:00 [superuser] (Ampache\Module\System\Session) -> opetd7larbo6fbfr5sr0uk4u5b has been extended to Thu, 11 Jan 2024 16:47:48 +0000 extension length 3600
2024-01-11T15:47:48+00:00 [superuser] (ajax.server) -> Called for page: {tag}
2024-01-11T15:47:48+00:00 [superuser] (ajax.server) -> Called for page: {tag}
2024-01-11T15:47:48+00:00 [superuser] (Ampache\Module\System\Session) -> Writing to opetd7larbo6fbfr5sr0uk4u5b with expiration 1704991668
2024-01-11T15:47:48+00:00 [superuser] (Ampache\Module\System\Session) -> Writing to opetd7larbo6fbfr5sr0uk4u5b with expiration 1704991668
2024-01-11T15:47:48+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:47:48+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:47:48+00:00 [superuser] (Ampache\Module\System\Session) -> opetd7larbo6fbfr5sr0uk4u5b has been extended to Thu, 11 Jan 2024 16:47:48 +0000 extension length 3600
2024-01-11T15:47:48+00:00 [superuser] (Ampache\Module\Application\ApplicationRunner) -> Found handler "Ampache\Module\Api\Edit\ShowEditObjectAction" for action "show_edit_object"
2024-01-11T15:47:48+00:00 [superuser] (Ampache\Module\Api\Edit\AbstractEditAction) -> Called for action: {show_edit_object}
2024-01-11T15:47:48+00:00 [superuser] (Ampache\Module\Api\Edit\AbstractEditAction) -> Ampache\Repository\Model\Album
2024-01-11T15:47:48+00:00 [superuser] (Ampache\Module\Api\Edit\AbstractEditAction) -> 1649
2024-01-11T15:47:48+00:00 [superuser] (Ampache\Module\System\Session) -> Writing to opetd7larbo6fbfr5sr0uk4u5b with expiration 1704991668


And this is after I've clicked "Save":

> 2024-01-11T15:47:59+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:47:59+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:47:59+00:00 [bcns] (Ampache\Module\System\Session) -> opetd7larbo6fbfr5sr0uk4u5b has been extended to Thu, 11 Jan 2024 16:47:59 +0000 extension length 3600
2024-01-11T15:47:59+00:00 [superuser] (Ampache\Module\Application\ApplicationRunner) -> Found handler "Ampache\Module\Api\Edit\EditObjectAction" for action "edit_object"
2024-01-11T15:47:59+00:00 [superuser] (Ampache\Module\Api\Edit\AbstractEditAction) -> Called for action: {edit_object}
2024-01-11T15:47:59+00:00 [superuser] (Ampache\Module\Api\Edit\AbstractEditAction) -> Ampache\Repository\Model\Album
2024-01-11T15:47:59+00:00 [superuser] (Ampache\Module\Api\Edit\AbstractEditAction) -> 1649
2024-01-11T15:47:59+00:00 [superuser] (Ampache\Module\Api\Edit\EditObjectAction) -> edit_object: {album} {1649}
2024-01-11T15:47:59+00:00 [superuser] (/pathtowww/ampache-6.2.1/src/Repository/Model/Album.php:966) -> Cannot assign string to property Ampache\Repository\Model\Album::$original_year of type ?int
2024-01-11T15:47:59+00:00 [superuser] (Ampache\Module\System\Session) -> Writing to opetd7larbo6fbfr5sr0uk4u5b with expiration 1704991679
2024-01-11T15:48:00+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:48:00+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:48:00+00:00 [superuser] (Ampache\Module\System\Session) -> opetd7larbo6fbfr5sr0uk4u5b has been extended to Thu, 11 Jan 2024 16:48:00 +0000 extension length 3600
2024-01-11T15:48:00+00:00 [superuser] (Ampache\Module\Application\ApplicationRunner) -> Found handler "Ampache\Module\Application\Album\ShowAction" for action "show"
2024-01-11T15:48:00+00:00 [superuser] (Ampache\Module\System\Session) -> Session created: 913e530b3c22e3cfa56c0cbb87e6bbaf
2024-01-11T15:48:00+00:00 [superuser] (Ampache\Module\System\AutoUpdate) -> GitHub API request https://api.github.com/repos/ampache/ampache/tags
2024-01-11T15:48:00+00:00 [superuser] (Ampache\Repository\Model\Browse) -> show_objects called. browse {27} type {song}
2024-01-11T15:48:01+00:00 [superuser] (Ampache\Module\System\Session) -> Writing to opetd7larbo6fbfr5sr0uk4u5b with expiration 1704991681
2024-01-11T15:48:01+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:48:01+00:00 [ampache] (Ampache\Module\System\Dba) -> Database connection...
2024-01-11T15:48:01+00:00 [superuser] (Ampache\Module\System\Session) -> opetd7larbo6fbfr5sr0uk4u5b has been extended to Thu, 11 Jan 2024 16:48:01 +0000 extension length 3600
2024-01-11T15:48:01+00:00 [superuser] (ajax.server) -> Called for page: {browse}
2024-01-11T15:48:01+00:00 [superuser] (browse.ajax) -> Called for action: {get_filters}
2024-01-11T15:48:01+00:00 [superuser] (Ampache\Module\System\Session) -> Writing to opetd7larbo6fbfr5sr0uk4u5b with expiration 1704991681

Seems that maybe `2024-01-11T15:47:59+00:00 [superuser] (/pathtowww/ampache-6.2.1/src/Repository/Model/Album.php:966) -> Cannot assign string to property Ampache\Repository\Model\Album::$original_year of type ?int` might be the culprit here?
For me, the problem seems to have gone away following a "gather artwork" operation on the catalog
@lachlan-00 > Is this when editing?

No, it appears on the "browse album" page too. Almost half of the albums on one page are wrongly showing the artist name.

@drder66 I just did a "gather artwork" and nothing changed for me.
f562bfece checks for a valid int for original year.

If the album is incorrect on the browse page then it's importing the tags incorrectly. (I'm assuming the database for these albums is showing the artist name if that's the case)

uncomment this debug to get your tag resutls from an update action (`src/Repository/Model/Catalog.php`)

![image](https://github.com/ampache/ampache/assets/1305249/181976b0-0a13-4e54-9972-188d254c1cf7)

then just do an update from tags for a single song or the album
it might also be related to a change in the tag order. `src/Module/Util/VaInfo.php`

![image](https://github.com/ampache/ampache/assets/1305249/8480ff5d-8827-4867-89e4-00fb073c6803)

@lachlan-00 

Here are the logs after activating those debug events :  

```
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Application\ApplicationRunner) -> Found handler "Ampache\Module\Application\Album\UpdateFromTagsAction" for action "update_from_tags"
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\System\Session) -> Session created: ae89fddee7efd0264ee035c1e188e05d
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) -> Reading tags from /media2/Singles/Wilkinson_-_Decompression.wav
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) -> get_tag_type: getid3_tag_orderArray
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) -> (
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) ->     [0] => id3v2
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) ->     [1] => general
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) -> )
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) -> 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) -> get_tag_type: metadata_orderArray
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) -> (
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) ->     [0] => getid3
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) ->     [1] => filename
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) ->     [2] => general
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) -> )
2024-01-16T19:10:01+00:00 [admin] (Ampache\Module\Util\VaInfo) -> 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) -> update_song_from_tags results: Array
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) -> (
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [albumartist] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [album] => Decompression
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [artist] => Wilkinson
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [artists] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [art] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [audio_codec] => wav
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [barcode] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [bitrate] => 1411200
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [catalog_number] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [channels] => 2
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [comment] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [composer] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [description] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [disk] => 0
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [disksubtitle] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [display_x] => 0
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [display_y] => 0
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [encoding] => UTF-8
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [file] => /media2/Singles/Wilkinson_-_Decompression.wav
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [frame_rate] => 0
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [genre] => Array
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->         (
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->             [0] => Drum & Bass
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->         )
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) -> 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [isrc] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [language] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [lyrics] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [mb_albumartistid] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [mb_albumartistid_array] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [mb_albumid_group] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [mb_albumid] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [mb_artistid] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [mb_artistid_array] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [mb_trackid] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [mime] => audio/wav
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [mode] => cbr
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [original_name] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [original_year] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [publisher] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [r128_album_gain] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [r128_track_gain] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [rate] => 44100
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [rating] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [release_date] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [release_status] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [release_type] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [replaygain_album_gain] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [replaygain_album_peak] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [replaygain_track_gain] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [replaygain_track_peak] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [resolution_x] => 0
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [resolution_y] => 0
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [size] => 48140188
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [version] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [summary] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [time] => 269
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [title] => Decompression
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [totaldisks] => 0
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [totaltracks] => 0
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [track] => 1
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [tvshow_art] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [tvshow_episode] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [tvshow] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [tvshow_season_art] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [tvshow_season] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [tvshow_summary] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [tvshow_year] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [video_bitrate] => 0
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [video_codec] => 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) ->     [year] => 2018
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) -> )
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Catalog) -> 
2024-01-16T19:10:01+00:00 [admin] (Ampache\Repository\Model\Tag) -> update_tag_list album: {234}
```
I don't think it is related to the tag import itself, because the albums (that have been replaced by the artist name) are in the order of the actual album name on the browse albums page.
See below :  

The actual album names are : 
[diffraction] - Camellia
1234567890 - KATOMORI
1997 - Alicks
404 - Just a Gent
Activated - Infekt
Agari Vol. 009 - Various
Aim To Kill EP - Terravita

![image](https://github.com/ampache/ampache/assets/151439279/a26ef5f5-abab-49ff-874e-b6dfd3cd5035)

> [f562bfe](https://github.com/ampache/ampache/commit/f562bfece139c96c904bf7d491a2223d9d39f2bb) checks for a valid int for original year.

I don't have the same error as him, and I tried to rebuild my catalog with f562bfe, same problem.
ahh, could this be no album artist tags? that can definitely cause issues there is a helper function to try and add those

@TanqBQZ are all your problems with albums missing an album artist tag?
for the albums that are wrong can you get the sql rows for them?

i've gone through the Album check code and the templates all seem to point to the right spots

oh and do the links for the album column go to the album correctly or do they go to the artist? (eg album link is correct but the text is wrong?)
![image](https://github.com/ampache/ampache/assets/1305249/ce090c2f-0f93-4c22-a2c6-02a8ea8c63bb)

> ahh, could this be no album artist tags? that can definitely cause issues there is a helper function to try and add those
> 
> @TanqBQZ are all your problems with albums missing an album artist tag?

This. I located all albums which displayed incorrectly, set ALBUMARTIST-tag on all tracks of the album, updated the tags and BAM! Album-name is now showing again. Thanks for the help on this one!
> ahh, could this be no album artist tags? that can definitely cause issues there is a helper function to try and add those
> 
> @TanqBQZ are all your problems with albums missing an album artist tag?

Indeed, all albums that have the issue don't have an album artist tag. Where is that helper function you mentioned?
Most of my files don't have an album artist tag, I could retag them but I wish that ampache would work fine without, like prior to 6.2.

> oh and do the links for the album column go to the album correctly or do they go to the artist? (eg album link is correct but the text is wrong?)

The links go to the album correctly.


I can confirm that if the album artist tag is empty when you update the catalogue the album title seems to be the artist name
I've got the same issue caused by e3c6913a6143d651bba1d687fdc93ae46d431452 on the list view (`/artists.php?action=show&artist=xxx`).

Same problem here, but just wanted to add that in the Recently Played list, everything is listed correctly.
same problem here, album name shows up as artist name in the catalog, but in Recently played and Now Playing it shows correctly
@lachlan-00 Do you have an update on this?
Having the same problem here, some of the album names are showing the artist in the album listing and details. 
I have tried gather art and update oprations many times. I have verified with mp3tag the tags for my flac files. 
Also It is unable to import some of the album covers. 
When I open a song from the affected albums the correct album name appears there. 

<img width="1270" alt="image" src="https://github.com/ampache/ampache/assets/11786511/a7a8beac-ec96-4ca8-a718-887704bdf8d8">
<img width="764" alt="image" src="https://github.com/ampache/ampache/assets/11786511/9ef4c141-b2dc-4e87-ab53-68883687016f">


Fix patch:
diff --git a/src/Repository/Model/Album.php b/src/Repository/Model/Album.php
index 9e59b23bc9..bc1e410447 100644
--- a/src/Repository/Model/Album.php
+++ b/src/Repository/Model/Album.php
@@ -221,13 +221,13 @@ private function _get_extra_info(): array
         }
         $results = array();
         if (empty($this->album_artist) && $this->song_artist_count == 1) {
-            $sql        = "SELECT MIN(`song`.`id`) AS `song_id`, `artist`.`name`, `artist`.`prefix`, MIN(`artist`.`id`) AS `artist_id` FROM `song` INNER JOIN `artist` ON `artist`.`id`=`song`.`artist` WHERE `song`.`album` = " . $this->id . " GROUP BY `song`.`album`, `artist`.`prefix`, `artist`.`name`";
+            $sql        = "SELECT MIN(`song`.`id`) AS `song_id`, `artist`.`name` AS `artist_name`, `artist`.`prefix` AS `artist_prefix`, MIN(`artist`.`id`) AS `artist_id` FROM `song` INNER JOIN `artist` ON `artist`.`id`=`song`.`artist` WHERE `song`.`album` = " . $this->id . " GROUP BY `song`.`album`, `artist`.`prefix`, `artist`.`name`";
             $db_results = Dba::read($sql);
             $results    = Dba::fetch_assoc($db_results);
             // overwrite so you can get something
             $this->album_artist  = $results['artist_id'] ?? null;
-            $this->artist_prefix = $results['prefix'] ?? null;
-            $this->artist_name   = $results['name'] ?? null;
+            $this->artist_prefix = $results['artist_prefix'] ?? null;
+            $this->artist_name   = $results['artist_name'] ?? null;
         }
         $this->has_art();
 


Test patch: