Imgalbum unter PHP 8

Third Party Plugins to CMSimple - how to install, use and create plugins

Moderator: Tata

Post Reply
Berni
Posts: 132
Joined: Wed Feb 12, 2014 4:38 pm
Contact:

Imgalbum unter PHP 8

Post by Berni » Tue Jan 24, 2023 6:13 am

Auch Imgalbum scheint unter PHP >7 wohl ein ernstes Problem zu haben.
Sowohl beim Seitenaufruf, als auch im Backend gibt es einen fatalen 500er Fehler
beim Aufruf des Plugins.

Code: Select all

Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /barleber-see.de/cmsimple_xh/plugins/imgalbum/libs/prettyphoto/index.php:23
Stack trace:
#0 /barleber-see.de/cmsimple_xh/plugins/imgalbum/libs/prettyphoto/index.php(23): in_array()
#1 /barleber-see.de/cmsimple_xh/plugins/imgalbum/libs/gallery_functions.php(230): include_once('...')
#2 /barleber-see.de/cmsimple_xh/plugins/imgalbum/index.php(190): sgallery_load_lightbox()
#3 /barleber-see.de/cmsimple_xh/cmsimple/functions.php(242) : eval()'d code(1): imgalbum()
#4 /barleber-see.de/cmsimple_xh/cmsimple/functions.php(242): eval()
#5 /barleber-see.de/cmsimple_xh/cmsimple/functions.php(202): XH_evaluateSinglePluginCall()
#6 /barleber-see.de/cmsimple_xh/cmsimple/functions.php(299): evaluate_plugincall()
#7 /barleber-see.de/cmsimple_xh/cmsimple/cms.php(1287): evaluate_scripting()
#8 /barleber-see.de/cmsimple_xh/index.php(6): include('...')
#9 {main}
thrown in /barleber-see.de/cmsimple_xh/plugins/imgalbum/libs/prettyphoto/index.php on line 23
Updater sagt mir, dass die installierte Version Imgalbum 1.5.0 aktuell wäre
Und der Debug-Modus wirft KEINEN Fehler aus.

Ruft man das Plugin im Admin-Menü auf, dann gibt es diese Fehlermeldung:

Code: Select all

Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /barleber-see.de/cmsimple_xh/plugins/imgalbum/libs/gallery_adminfunctions.php:11
Stack trace:
#0 /barleber-see.de/cmsimple_xh/plugins/imgalbum/libs/gallery_adminfunctions.php(11): in_array()
#1 /barleber-see.de/cmsimple_xh/plugins/imgalbum/admin.php(27): sgallery_admin()
#2 /web/barleber-see.de/cmsimple_xh/cmsimple/cms.php(1123): include('...')
#3 /barleber-see.de/cmsimple_xh/index.php(6): include('...')
#4 {main}
thrown in /barleber-see.de/cmsimple_xh/plugins/imgalbum/libs/gallery_adminfunctions.php on line 11

cmb
Posts: 14225
Joined: Tue Jun 21, 2011 11:04 am
Location: Bingen, RLP, DE
Contact:

Re: Imgalbum unter PHP 8

Post by cmb » Tue Jan 24, 2023 10:51 am

Berni wrote:
Tue Jan 24, 2023 6:13 am
Auch Imgalbum scheint unter PHP >7 wohl ein ernstes Problem zu haben.
Sowohl beim Seitenaufruf, als auch im Backend gibt es einen fatalen 500er Fehler
beim Aufruf des Plugins.
Ja, tatsächlich. Das Problem ist die Behandlung von jQuery-Plugins. In imgalbum/libs/gallery_adminfunctions.php findet sich ab Zeile 8 folgender Code:

Code: Select all

	//Initialize jQuery and MultiFile plugin	
	include_once($pth['folder']['plugins'].'jquery/jquery.inc.php');
	include_jQuery();
	if (!in_array('MultiFile', $jQueryPlugins)) {
		include_jQueryPlugin('MultiFile', $pth['folder']['plugins'].$plugin.'/libs/multifile/jquery.MultiFile.pack.js'); 
	}
Die Abfrage, ob sich MultiFile in $jQueryPlugins befindet, schlägt fehl, wenn nicht irgendwo zuvor bereits include_jQueryPlugin() aufgerufen wurde. Soweit ich es überblicke, ist die Abfrage aber gar nicht nötig, da die mehrfache Einbindung bereits von include_jQueryPlugin() verhindert wird. Also weg damit:

Code: Select all

	//Initialize jQuery and MultiFile plugin	
	include_once($pth['folder']['plugins'].'jquery/jquery.inc.php');
	include_jQuery();
	include_jQueryPlugin('MultiFile', $pth['folder']['plugins'].$plugin.'/libs/multifile/jquery.MultiFile.pack.js'); 
Das gleiche Problem tritt auch in imgalbum/libs/imagelightbox/index.php, imgalbum/libs/magnificpopup/index.php, imgalbum/libs/prettyphoto/index.php und imgalbum/libs/swipebox/index.php. Dort befindet sich jeweils recht weit oben etwa folgende Zeile (mal steht da halt prettyphoto, mal halt ein anderer Name):

Code: Select all

if (!in_array('prettyphoto', $jQueryPlugins)) {
Der Einfachheit halber ersetzen durch

Code: Select all

if (true) {
Christoph M. Becker – Plugins for CMSimple_XH

Berni
Posts: 132
Joined: Wed Feb 12, 2014 4:38 pm
Contact:

Re: Imgalbum unter PHP 8

Post by Berni » Fri Jan 27, 2023 7:08 pm

Mit diesen Änderungen läuft das Plugin wieder.
Danke für den Fix.

Post Reply