plegall / Piwigo-community

11 stars 23 forks source link

Warnings in Configuration Tab - PHP 8 incompatibility #77

Closed francwalter closed 7 months ago

francwalter commented 1 year ago

Hallo I just installed Piwigo 13.3.0 local with Apache 2.4 and PHP 8.0 After installing this Plugin Community I get warnings in the Configuration Tab:

C:\Apache24\htdocs\Piwigo\_data\templates_c\p6jhns^5917e50e6ff99ed9cb7da09cf713fa55d706fa71_0.file.admin_config.tpl.php on line 50

Warning: Attempt to read property "value" on null in C:\Apache24\htdocs\Piwigo\_data\templates_c\p6jhns^5917e50e6ff99ed9cb7da09cf713fa55d706fa71_0.file.admin_config.tpl.php on line 50
"> 

and when I try to add a permission I get warnings:

 Warning: Undefined array key "recursive" in C:\Apache24\htdocs\Piwigo\_data\templates_c\p6jhns^eb3b027ee0951a717a12d7f8a2adbd53abe12cd6_0.file.admin_permissions.tpl.php on line 256

Warning: Attempt to read property "value" on null in C:\Apache24\htdocs\Piwigo\_data\templates_c\p6jhns^eb3b027ee0951a717a12d7f8a2adbd53abe12cd6_0.file.admin_permissions.tpl.php on line 256
> Apply to sub-albums
Warning: Undefined array key "create_subcategories" in C:\Apache24\htdocs\Piwigo\_data\templates_c\p6jhns^eb3b027ee0951a717a12d7f8a2adbd53abe12cd6_0.file.admin_permissions.tpl.php on line 259

Warning: Attempt to read property "value" on null in C:\Apache24\htdocs\Piwigo\_data\templates_c\p6jhns^eb3b027ee0951a717a12d7f8a2adbd53abe12cd6_0.file.admin_permissions.tpl.php on line 259
> ability to create sub-albums

When I switch to PHP 7.4 the warnings are gone. Obviously this plugin is not ready for PHP 8+ but PHP 7+ is deprecated and EOL since weeks now. It is not the only broken Plugin in Piwigo. I wonder why Piwigo core is updated heavily but many important Plugins, which only make Piwigo worth using, are not, development nearly stopped.

I just used Piwigo after a while again for gathering pictures after a meeting, told the people they could upload their pictures to my gallery. None of them uploaded any picture, surely because the Plugin didnt work :( And the forum is broken too, so no way to get it fixed or ask how to fix it. frank

plegall commented 1 year ago

I'm going to fix this, but I'm also going to reply to this:

I wonder why Piwigo core is updated heavily but many important Plugins, which make Piwigo worth using only are not

Because we can't do all at the same time. We're going to fix or help maintainers to fix major plugins to be compatible with PHP 8. The upgrade to PHP 8 has broken many pieces of code. You could also wonder why PHP creators are breaking things this way :-)

francwalter commented 1 year ago

OK, thank. And could you fix the forum first?

plegall commented 1 year ago

and how is the forum broken? (because of course, it's not broken for many people since we receive some messages)

francwalter commented 1 year ago

I tried to reset the password, but never got the email with the password reset link. The forum doesn't send it (broken).

Then I tried to send an email to the forum admin, but never got an answer. On 2. dec. at 1242 I even sent an email to you, @plegall to your gmail address about it.

But yesterday I tried again my old password and it works :)

francwalter commented 1 year ago

Look, when I try to register in the english forum (the german forum I can login) with username "francwalter" I get the info, that already someone is registered as francwalter. OK then, I try to reset password (the password I used didnt work) with the email I think I used when register (I use always the same for forums) and I get: grafik But do you think that at any time I would get that mail? Never. I can retry hundreds of times, look in spam and never an email to change my password would come. So this is broken at least, I think. Surely I tried to contact the admin, as proposed, but this is just in vain, never he (or she) answered to me.

Could you fix that?

EDIT: but never mind, the german forum works, and my german is anyway much better than my english, some kind of native language, german to me 😏

plegall commented 1 year ago

you have my reply by email about the forum issue.

ceepeebee213 commented 1 year ago

Hi - I know it's been a while but has there been any progress on this? I've come to use Piwigo and get it up and running for a community that I'm looking after (submission-based) and I've come against the same error when using this plugin.

Thanks in advance

aptonline commented 1 year ago

Same here, installed the plug-in and receiving the same error when selection the 'Configuration' tab:

/config/www/_data/templates_c/p6jhns^89ea1c7dfcba80520cd5ce5c53ef9c82334b8462_0.file.admin_config.tpl.php on line 50

Warning: Attempt to read property "value" on null in /config/www/_data/templates_c/p6jhns^89ea1c7dfcba80520cd5ce5c53ef9c82334b8462_0.file.admin_config.tpl.php on line 50
"> 
MrFranke commented 1 year ago

Same problem Downgrade Piwigo fix this issue for me

francwalter commented 1 year ago

Downgrade Piwigo to which version? I thought this is PHP 8 related!?

MrFranke commented 1 year ago

@francwalter version 11.5.0, yes, this version include old PHP version

francwalter commented 1 year ago

This i not understand! Piwigo is only running under PHP but does not contain the PHP.

PHP 7.4 is now old and deprecated and should not be used anymore on any server in the internet, exposed to attacks with unfixed security issues. On my server I switched to 8.0, in November 22. 8.0 is EOL as well end of this year, then I will upgrade to 8.1 or even 8.2 or 8.3. I don't want to take that risk to be hacked, this is not a sugar licking, to fix such things and you loose reputation as well (I run a mail server, reputation there is crucial). Piwigo without that community plugin is just another gallery. For me the feature that other user could upload their pictures is the very only feature I really need, would need at the moment. But I understand that this takes time and it is done by unpaid enthusiasts, so I won't complain ;)

aptonline commented 1 year ago

Any update on this issues?

Bulgus commented 1 year ago

Same issue. PHP : 8.0.28 Piwigo : 13.7.0

francwalter commented 1 year ago

It is something in that smarty template:

plugins/community/admin_config.tpl

There is in line 23 that

...
<form method="post" action="{$F_ACTION}">
...

where the $F_ACTION->value is empty (null) and so the form action is broken (and with it the form). That could have worked in PHP 7, to pass empty values to the template, I guess, but not anymore in 8. So in the code, it must be checked if null and only if not null, it could be filled.

When I remove that Smarty Var in the action="... then the error disappears. So now I have in line 23 only:

<form method="post" action="">

But there are more errors, on the Upload permission tab, when I try to add a permission, there are errors in this template:

plugins/community/admin_permissions.tpl

In line 199 and 201:

<label><input type="checkbox" name="recursive" {if $recursive}checked="checked"{/if}> {'Apply to sub-albums'|@translate}</label>
<label><input type="checkbox" name="create_subcategories" {if $create_subcategories}checked="checked"{/if}> {'ability to create sub-albums'|@translate}</label>

also here the PHP errors from it:

 Warning: Undefined array key "recursive" in /.../piwigo/_data/templates_c/p6jhns^0f1ddb6710e71a347e282ec638ca65aa8e04158d_0.file.admin_permissions.tpl.php on line 256

Warning: Attempt to read property "value" on null in /.../piwigo/_data/templates_c/p6jhns^0f1ddb6710e71a347e282ec638ca65aa8e04158d_0.file.admin_permissions.tpl.php on line 256

Warning: Undefined array key "create_subcategories" in /.../piwigo/_data/templates_c/p6jhns^0f1ddb6710e71a347e282ec638ca65aa8e04158d_0.file.admin_permissions.tpl.php on line 259

Warning: Attempt to read property "value" on null in /.../piwigo/_data/templates_c/p6jhns^0f1ddb6710e71a347e282ec638ca65aa8e04158d_0.file.admin_permissions.tpl.php on line 259

I deleted also here the parts which are throwing errors, deleting the template cache (remove files in _data/templates_c/, without the index.php) to test, so now I have in line 199 and 201 of: plugins/community/admin_permissions.tpl this: <label><input type="checkbox" name="recursive" </label> and <label><input type="checkbox" name="create_subcategories" </label> and the PHP Warnings (errors) are gone.

But I dont know if that deleting didnt break something (I even dont know what are the deleted parts for) and have not the time to test that. So please, @plegall for you it is just a finger tip to fix that precisely, could you have a look? Thanks!

Maybe it has something to do with this PHP 8 stuff: Backward Incompatible Changes here I read:

_The ability to use array_key_exists() with objects has been removed. isset() or property_exists() may be used instead._