Announcement

#1 2024-02-24 16:13:08

Tnkrr
Member
2024-02-20
3

Updating Permissions on PHP 8.0^

Hey guys!

I have encounterd a problem and a workaround! But i want to make a notice about it here!

When on PHP 8.0 or higher, when you want to give groups rights to albums and click send. Then you will receive an error every time you visit the Rights page. And the Rights are not updated either.

Code:

Fatal error: Uncaught ValueError: Unknown format specifier "j" in /home/reizicloud/htdocs/include/functions.inc.php:1260 Stack trace: #0 /home/reizicloud/htdocs/include/functions.inc.php(1260): vsprintf() #1 /home/reizicloud/htdocs/_data/templates_c/8cpdn4^bfa409ee3da4f74c596d136877e43413cd9b1bf5_0.file.cat_perm.tpl.php(158): l10n() #2 /home/reizicloud/htdocs/include/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_65d9502914e1f8_33869427() #3 /home/reizicloud/htdocs/include/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode() #4 /home/reizicloud/htdocs/include/smarty/libs/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render() #5 /home/reizicloud/htdocs/include/smarty/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render() #6 /home/reizicloud/htdocs/include/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute() #7 /home/reizicloud/htdocs/include/template.class.php(483): Smarty_Internal_TemplateBase->fetch() #8 /home/reizicloud/htdocs/include/template.class.php(406): Template->parse() #9 /home/reizicloud/htdocs/admin/cat_perm.php(297): Template->assign_var_from_handle() #10 /home/reizicloud/htdocs/admin/album.php(79): include('...') #11 /home/reizicloud/htdocs/reizi.cloud/admin.php(346): include('...') #12 {main} thrown in /home/reizicloud/htdocs/include/functions.inc.php on line 1260

As soon as you start using PHP7.4\/ the error will disappear and you can adjust the permissions. This is something that the Piwigo team needs to look into

https://i.imgur.com/NaSYVed.png

Offline

 

#2 2024-02-25 19:35:03

erAck
Only trying to help
2015-09-06
2036

Re: Updating Permissions on PHP 8.0^

I'd guess that is a fallout from some (Dutch?) translation file error. Try if when using the English (UK) interface the error is gone.


Running Piwigo at https://erack.net/gallery/

Offline

 

#3 2024-03-26 18:32:57

BMS
Member
2015-12-24
17

Re: Updating Permissions on PHP 8.0^

I got the same problem, and it is indeed some Dutch translation file error.
Switching the Admin to any other language the error is gone.
But what next, how can I track the error? I already removed all language entries in the LocalFiles Editor.
The problem started after upgrading to PHP 8.0, probably being more strict.
Should I search in the translations for "j" or some syntax error?
Any suggestions?

Last edited by BMS (2024-03-26 18:40:00)

Offline

 

#4 2024-03-27 12:41:27

BMS
Member
2015-12-24
17

Re: Updating Permissions on PHP 8.0^

Problem Solved.
Switched back to PHP 7.4 and looked on the 'Rights' page for a weird translation.

https://www.makkink.eu/piwigo/rights.jpg

Found in the file ../language/nl_NL/admin.lang.php line 822 the following translation:

Code:

 822 $lang['%u users have automatic permission because they belong to
                 a granted group.'] =
                 '%jouw gebruikers hebben automatisch recht, omdat ze
                  tot een groep behoren die dit recht is verleend';

The error occurs right at the beginning of the dutch translation with "%jouw" which leads to the unknown format specifier "j".
The code should be "%u jouw".

The actual dutch translation however still makes no sense. To remedy the fatal error and to avoid hacking the language file, one should add in the "Languages" tab (Nederlands) of the LocalFiles Editor the following code:

Code:

$lang['%u users have automatic permission because they belong to
                 a granted group.'] =
                 '%u gebruikers hebben automatisch toegang, omdat
                  ze tot een groep behoren met dit recht.';

Last edited by BMS (2024-03-28 14:05:17)

Offline

 

#5 2024-03-28 13:45:44

erAck
Only trying to help
2015-09-06
2036

Re: Updating Permissions on PHP 8.0^

There's a still pending pull request for that, https://github.com/Piwigo/Piwigo/pull/2121


Running Piwigo at https://erack.net/gallery/

Offline

 

Board footer

Powered by FluxBB

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