#1 2023-01-25 03:43:46

fossa
Member
2023-01-25
1

Can't upload photos on PHP8

Hello,

It seems that I've found a bug in piwigo 13.5.0.

How to reproduce:
1) Have a fresh setup (environment is below):


    Piwigo 13.5.0 Check for upgrade
    Installed on 25 January 2023, 2 hours ago
    Operating system: Linux
    PHP: 8.1.14 (Show info) [2023-01-25 05:40:04]
    MySQL: 10.5.18-MariaDB [2023-01-25 03:40:04]
    Graphics Library: ImageMagick 6.9.12-70
    Cache size N/A   never calculated Refresh

2) Try to upload photos with unlimited POST size in php.ini (i.e. set to 0). You'll get a warning about "you need to fix your php.ini" (which is wrong, BTW).

3) Discard the warning above.

4) Photos upload is now broken, any attempt to upload a photo results in next error message:

Warning: Undefined array key "setup_warnings" in /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/_data/templates_c/p6jhns^999b4549e64e9ca36b170f12e8bbb482f64ba327_0.file.photos_add_direct.tpl.php on line 488

Warning: Attempt to read property "value" on null in /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/_data/templates_c/p6jhns^999b4549e64e9ca36b170f12e8bbb482f64ba327_0.file.photos_add_direct.tpl.php on line 488

Fatal error: Uncaught TypeError: count(): Argument #1 ($value) must be of type Countable|array, null given in /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/_data/templates_c/p6jhns^999b4549e64e9ca36b170f12e8bbb482f64ba327_0.file.photos_add_direct.tpl.php:488 Stack trace: #0 /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/include/smarty/libs/sysplugins/smarty_template_resource_base.php(123): content_63d0934ff285f6_20227419() #1 /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/include/smarty/libs/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode() #2 /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/include/smarty/libs/sysplugins/smarty_internal_template.php(216): Smarty_Template_Compiled->render() #3 /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/include/smarty/libs/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render() #4 /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/include/smarty/libs/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute() #5 /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/include/template.class.php(469): Smarty_Internal_TemplateBase->fetch() #6 /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/include/template.class.php(392): Template->parse() #7 /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/admin/photos_add_direct.php(158): Template->assign_var_from_handle() #8 /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/admin/photos_add.php(73): include('/mnt/bigdisk0/w...') #9 /webroot/vhosts/gallery.fossa.life/htdocs/admin.php(345): include('/mnt/bigdisk0/w...') #10 {main} thrown in /mnt/bigdisk0/webroot/gallery.fossa.life/htdocs/_data/templates_c/p6jhns^999b4549e64e9ca36b170f12e8bbb482f64ba327_0.file.photos_add_direct.tpl.php on line 488

Unfortunately I'm not a PHP developer, but as I understand the bug is caused by PHP 8 requirement to have type countable for count() call. Instead null is given.

I believe that this is showstopper bug and need to be hotfixed ASAP.

Regards,
White Fossa.

Last edited by fossa (2023-01-25 03:44:13)

Offline

 

#2 2023-02-10 16:29:04

Tirs
Member
Canyelles
2016-09-18
8

Re: Can't upload photos on PHP8

Just a suggestion: As a workaround, did you try putting an arbitrarily large number in POST size, instead of just leaving it unlimited? Maybe this helps.

Offline

 

Board footer

Powered by FluxBB

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