• Resolved royrogers

    (@royrogers)


    Hi there,

    I get these PHP Warnings :

    Warning	Undefined array key 0	3	    wp-content/plugins/mp3-music-player-by-sonaar/includes/class-sonaar-music.php:317	
    Plugin: mp3-music-player-by-sonaarWarning	Trying to access array offset on value of type null	3	wp-content/plugins/mp3-music-player-by-sonaar/includes/class-sonaar-music.php:317 
    
    
    Warning	Undefined array key 0	1	    wp-content/plugins/mp3-music-player-by-sonaar/includes/class-sonaar-music-widget.php:215	Plugin: mp3-music-player-by-sonaarWarning	Trying to access array offset on value of type null	1	wp-content/plugins/mp3-music-player-by-sonaar/includes/class-sonaar-music-widget.php:215

    How I fixed:

     // $fileOrStream =  $album_tracks[0]['FileOrStream'];
    $fileOrStream = $album_tracks[0]['FileOrStream'] ?? null;
    
    • This topic was modified 1 year, 8 months ago by royrogers.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author sonaar

    (@sonaar)

    Hi,

    Thanks for reporting.

    ?I can’t seem to be able to reproduce it on my end. Is the playlist post had a tracklist set when this error shown up?

    If you still have issues, let me know.

    Thread Starter royrogers

    (@royrogers)

    This happens with or without a playlist.

    Anyway, I think you should always check for the array key in your PHP code. It maybe doesn’t show the error for you, but may show for others. I use PHP 8.0.22

    • This reply was modified 1 year, 7 months ago by royrogers.
    Thread Starter royrogers

    (@royrogers)

    You can see the error here (Query Monitor)

    https://pasteboard.co/kJ06Psi40Hyy.jpg

    • This reply was modified 1 year, 7 months ago by royrogers.
    Plugin Author sonaar

    (@sonaar)

    Thanks. we have fixed it and we should release a plugin update this weekend or in the beginning of next week (4.5.1)

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘PHP ERRORS and FIXES’ is closed to new replies.