Need Help to MYBB Plugin Avatar Gallery - Printable Version +- Makestation (https://makestation.net) +-- Forum: Technical Arts (https://makestation.net/forumdisplay.php?fid=45) +--- Forum: Software (https://makestation.net/forumdisplay.php?fid=104) +--- Thread: Need Help to MYBB Plugin Avatar Gallery (/showthread.php?tid=3357) |
Need Help to MYBB Plugin Avatar Gallery - tc4me - January 27th, 2021 HY i`m Need Help to MYBB Plugin Avatar Gallery Hey guys, sorry but once again it's not going as it should After the installation and after creating a new gallery (e.g. Test1), when I click on it in the ACP, the error occurs: Warning [2] count (): Parameter must be an array or an object that implements Countable - Line: 599 - File: admin / modules / user / avatar_gallery.php PHP 7.4.14 (Linux) File line function /admin/modules/user/avatar_gallery.php 599 errorHandler-> error /admin/index.php 824 require LINE 599 /admin/modules/user/avatar_gallery.php = if (count ($ avatar) == 0) I tried to upload an AVATAR anyway, after that it no longer shows the error in the ACP in the called gallery, the uploaded AVATAR is NOT shown in the ACP but in the user CP when you call this gallery it is available. see my screen, ############# ############# Then I have in the /admin/modules/user/avatar_gallery.php Line 599 if (count ($ avatar) == 0) changed on if (is_array ($ avatar) && count ($ avatar) == 0) changed the images are now also displayed in the ACP, however BUT :! when I do that comes: Warning [2] asort () expects parameter 1 to be array, null given - Line: 606 - File: admin / modules / user / avatar_gallery.php PHP 7.4.14 (Linux) File line function [PHP] errorHandler-> error /admin/modules/user/avatar_gallery.php 606 asort /admin/index.php 824 require Warning [2] Invalid argument supplied for foreach () - Line: 607 - File: admin / modules / user / avatar_gallery.php PHP 7.4.14 (Linux) File line function /admin/modules/user/avatar_gallery.php 607 errorHandler-> error /admin/index.php Line: 606/607: asort ($ avatar); foreach ($ avatar as $ key => $ file) And that BUT: if I upload an avatar to the new folder despite the error, the error message is gone and the avatar is also displayed in the new folder I've already tried to get help at Mybb.de, but unfortunately I didn't get any help Here the Plugin Lg Tc4me RE: Need Help to MYBB Plugin Avatar Gallery - Darth-Apple - January 27th, 2021 Hmm, looks like there's a bug in the actual plugin itself. The developer probably made this plugin for an older PHP version that was less picky about errors and warnings. Newer PHP versions throw warnings for things that older versions ignored, sometimes causing messages like these. Do you know what PHP version you're using? I'll take a look and fix it up later today. RE: Need Help to MYBB Plugin Avatar Gallery - tc4me - January 27th, 2021 (January 27th, 2021 at 5:29 PM)Darth-Apple Wrote: Hmm, looks like there's a bug in the actual plugin itself. The developer probably made this plugin for an older PHP version that was less picky about errors and warnings. Newer PHP versions throw warnings for things that older versions ignored, sometimes causing messages like these.Thank you Darth I got a tip from doylecc an admin from mybb.de and it works I looked at the file first. Just add under line 585: PHP code: $ avatars = @opendir (MYBB_ROOT. "/". $ mybb-> settings ['avatardir']. "/". $ directory); the following one: PHP code: $ avatar = array (); RE: Need Help to MYBB Plugin Avatar Gallery - Darth-Apple - January 28th, 2021 I think I've got it fixed. It was due to an unitialized variable that never gets set if there are no avatars. Even though it's trying to count and check if any exist, the variable itself was never declared prior, thus causing the warning. (This would have been ignored on prior PHP versions. More recent PHP versions started throwing warnings for this sort of thing. ). An easy fix is to add the isset() condition to the if statement. This will cause it to consider an unset variable to be an empty avatar list (as was intended by the plugin author). On line 599, replace: Code: if(count($avatar) == 0) WITH: Code: if(!isset($avatar) || count($avatar) == 0) RE: Need Help to MYBB Plugin Avatar Gallery - tc4me - January 28th, 2021 Yes !!!!!!!!! Perfekt |