Announcement

  •  » Extensions
  •  » Lightbox - Error choosing Theme

#1 2022-12-29 20:29:04

MrMister247
Member
2014-10-30
3

Lightbox - Error choosing Theme

Hi @ all,

I've been using Piwigo for about 3 years.

A few days ago i updated to php 8.1 and the lightbox-plugin stopped working.

My environment:
Piwigo 13.4.0 Prüfen, ob eine neue Version verfügbar ist.
Installiert auf 12 Juli 2019, vor 3 Jahre 5 Monate 2 Wochen 3 Tage
Betriebssystem: Linux
PHP: 8.1.13 (Info anzeigen) [2022-12-29 19:46:00]
MySQL: 10.3.37-MariaDB-0ubuntu0.20.04.1 [2022-12-29 19:46:00]

Actual Theme:
Bootstrap Darkroom

Settings-Page of the Lighbox-Plugin:
https://homeserver.hestera.at/test/plugin-settings.png

Error on Settings-Page:

Code:

Warning: Undefined array key "TAG_INPUT_ENABLED" in /var/www/html/pwg/_data/templates_c/p6jhns^2863d3b656ec6aadc4234f71a42c55fd4eb5558e_0.file.admin.tpl.php on line 193

Warning: Attempt to read property "value" on null in /var/www/html/pwg/_data/templates_c/p6jhns^2863d3b656ec6aadc4234f71a42c55fd4eb5558e_0.file.admin.tpl.php on line 193
>  Warning: Undefined array key "TAG_INPUT_ENABLED" in /var/www/html/pwg/_data/templates_c/p6jhns^2863d3b656ec6aadc4234f71a42c55fd4eb5558e_0.file.admin.tpl.php on line 197

Warning: Attempt to read property "value" on null in /var/www/html/pwg/_data/templates_c/p6jhns^2863d3b656ec6aadc4234f71a42c55fd4eb5558e_0.file.admin.tpl.php on line 197

Error on Picture-Page:

Code:

Fatal error: Uncaught TypeError: implode(): Argument #1 ($pieces) must be of type array, string given in /var/www/html/pwg/plugins/lightbox/lightbox.php:31 Stack trace: #0 /var/www/html/pwg/plugins/lightbox/lightbox.php(31): implode() #1 /var/www/html/pwg/plugins/lightbox/main.inc.php(18): include('...') #2 /var/www/html/pwg/include/functions_plugins.inc.php(214): lightbox_plugin() #3 /var/www/html/pwg/include/category_default.inc.php(146): trigger_change() #4 /var/www/html/pwg/index.php(306): include('...') #5 {main} thrown in /var/www/html/pwg/plugins/lightbox/lightbox.php on line 31

Does anyone have an idea?

Thank you and best regards
MrMister

Offline

 

#2 2022-12-30 14:50:19

gueba
Member
2021-12-31
55

Re: Lightbox - Error choosing Theme

Hi,
quick & dirty solutions.

Error on Settings-Page:

Edit lines 193 and 197 in file /var/www/html/pwg/_data/templates_c/p6jhns^2863d3b656ec6aadc4234f71a42c55fd4eb5558e_0.file.admin.tpl.php

Code:

193 " <?php echo $_smarty_tpl->tpl_vars['TAG_INPUT_ENABLED']->value;?>
197 ');" <?php echo $_smarty_tpl->tpl_vars['TAG_INPUT_ENABLED']->value;?>

to

Code:

193 " <?php echo @$_smarty_tpl->tpl_vars['TAG_INPUT_ENABLED']->;?>
197 ');" <?php echo @$_smarty_tpl->tpl_vars['TAG_INPUT_ENABLED']->value;?>

or better to

Code:

193 " <?php echo $_smarty_tpl->tpl_vars['TAG_INPUT_ENABLED']->value ?? null;?>
197 ');" <?php echo $_smarty_tpl->tpl_vars['TAG_INPUT_ENABLED']->value ?? null;?>

Be aware that these files are generated dynamically (with different filenames) if you change themes or delete compiled templates, so you will have to edit these files again.

Error on Picture-Page:

Edit line 31 in file /var/www/html/pwg/plugins/lightbox/lightbox.php

Code:

31 tagids:  "'.@implode(',', @$page['tag_ids']).'"

to

Code:

tagids:  "'.@implode([','], @$page['tag_ids']).'"

I'm not sure, if that's a proper solution, but it worked for me.

FYI: These Warnings ('undefined arrays' - 'value on null') show in other plugins,too (Take a tour, openstreetmap ...) and are caused by PHP8. They appear in the compiled templates, generated by the Smarty template engine.

Offline

 

#3 2022-12-30 15:49:50

MrMister247
Member
2014-10-30
3

Re: Lightbox - Error choosing Theme

Hi gueba,

thank you for the hint, unfortunately did not work for me.

I helped myself by using php7.4-fpm for just the Piwigo-Directory.

Best regards
MrMister

Offline

 

#4 2022-12-31 11:11:48

gueba
Member
2021-12-31
55

Re: Lightbox - Error choosing Theme

Edit: I just noticed that using Bootstrap Darkroom as main theme, lightbox shows every picture twice (even with php7)


Hi MrMister,

"did not work for me" is not a helpful bug-description.

Anyway, I reinspected the problem and found a working solution. It's a bit tricky.

If you - or someone else is interested, here are my steps to reproduce:

Piwigo Lightbox plugin with php 8.1

steps to reproduce (follow sequence below)

Server-Umgebung

    Piwigo 13.4.0 Prüfen, ob eine neue Version verfügbar ist.
    Installiert auf 9 Januar 2022, vor 11 Monate 3 Wochen
    Betriebssystem: Linux
    PHP: 8.1.13 (Info anzeigen) [2022-12-31 10:12:54]
    MySQL: 10.5.18-MariaDB-1:10.5.18+maria~ubu2004-log [2022-12-31 10:12:54]
    Grafikbibliothek: ImageMagick 6.9.10-23
    Größe des Cache 0 Mo   berechnet vor 4 Wochen Aktualisieren

Liste der aktivierten Plugins 7

    Automatic Size
    Lightbox
    LocalFiles Editor
    OpenStreetMap
    Panoramas
    Tag Groups
    VideoJS

1. Install and activate Lightbox plugin 12 a

2. Edit file PIWIGO-ROOT/plugins/lightbox/lightbox.php
Line 31:

original:

Code:

tagids: "'.@implode(',', @$page['tag_ids']).'"

new:

Code:

tagids: "'.@implode([','], @$page['tag_ids']).'"

3. In admin - properties set desired theme(s) (here: Bootstrap Darkroom) DON'T CHANGE THEMES FROM NOW ON!

4. In admin - maintenance panel delete compiled templates

5. In PIWIGO-ROOT/_data/templates_c/ you will see a file: (filename may differ - but must end to ...        _0.file.admin.tpl.php) DO NOT EDIT THIS FILE
p6jhns^504280b97ee7bf660105b36edf8f29e4ad28f76b_0.file.admin.tpl.php
   
6. Go to Plugins Lightbox-Config (Einstellungen)
You will see Warnings:

Code:

Warning: Undefined array key "TAG_INPUT_ENABLED" in /www/htdocs/w0058ce5/test/_data/templates_c/p6jhns^d315c6b850af0fa49507b27ad4fc983b41db4f7a_0.file.admin.tpl.php on line 193

Warning: Attempt to read property "value" on null in /www/htdocs/w0058ce5/test/_data/templates_c/p6jhns^d315c6b850af0fa49507b27ad4fc983b41db4f7a_0.file.admin.tpl.php on line 193
> Warning: Undefined array key "TAG_INPUT_ENABLED" in /www/htdocs/w0058ce5/test/_data/templates_c/p6jhns^d315c6b850af0fa49507b27ad4fc983b41db4f7a_0.file.admin.tpl.php on line 197

Warning: Attempt to read property "value" on null in /www/htdocs/w0058ce5/test/_data/templates_c/p6jhns^d315c6b850af0fa49507b27ad4fc983b41db4f7a_0.file.admin.tpl.php on line 197

7. In PIWIGO-ROOT/_data/templates_c/ you will see newly compiled file:
p6jhns^d315c6b850af0fa49507b27ad4fc983b41db4f7a_0.file.admin.tpl.php         

8. Edit this file: (and save)
Line 105                                                                       

original:

Code:

          <option label="<?php echo ucwords($_smarty_tpl->tpl_vars['theme']->value);?>

new:

Code:

          <option label="<?php echo ucwords($_smarty_tpl->tpl_vars['theme']->value ?? null);?>

Line 193:

original:

Code:

" <?php echo $_smarty_tpl->tpl_vars['TAG_INPUT_ENABLED']->value;?>

new:

Code:

" <?php echo $_smarty_tpl->tpl_vars['TAG_INPUT_ENABLED']->value ?? null;?>

Line 197:

original:

Code:

');" <?php echo $_smarty_tpl->tpl_vars['TAG_INPUT_ENABLED']->value;?>

new:

Code:

');" <?php echo $_smarty_tpl->tpl_vars['TAG_INPUT_ENABLED']->value ?? null;?>

9. Refresh the lightbox - config - page in your browser   --> the warnings have disappeared

10. Press "Submit" (Absenden)

11. Go to your Gallery and see the working lightbox-plugin


Always keep in mind that every change in configuration (changing adding themes etc) may cause your edited files in PIWIGO-ROOT/_data/templates_c to be changed (so does deleting compiled templates)
and thus you will have to redo the procedure from point 4.

Last edited by gueba (2022-12-31 12:35:32)

Offline

 

#5 2022-12-31 15:43:40

MrMister247
Member
2014-10-30
3

Re: Lightbox - Error choosing Theme

Hi gueba,

thank you for your post.

You're right, "did not work for me" is not very helpful.

What I meant is that using php7.4 only for the piwigo directory on my server works for me. Also I do not have the problem that each image is shown twice (but I know the phenomenon, but has disappeared at some point).

After I tried the info of your first post the error messages on the settings page were gone, but it was still the theme dropdown with the error from my first post and as a result the error on the image page.

But I will try your tip in the next time, thanks for that.

Best regards and all the best in the new year

MrMister

Offline

 

#6 2023-08-17 20:30:25

stevesullam
Member
2019-07-05
2

Re: Lightbox - Error choosing Theme

I got to step 8., but then I couldn't find the lines that need editing anywhere in my (random numbers)admin.tpl.php I'm using Piwigo 13.8.0. php8.1

Ha ha. I just check and the lightbox effect is working any way. Typical.

Last edited by stevesullam (2023-08-17 20:34:29)

Offline

 
  •  » Extensions
  •  » Lightbox - Error choosing Theme

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact