gregstoll / gallery2

A fork of the Gallery project (galleryproject.org) that supports PHP 8
GNU General Public License v2.0
44 stars 24 forks source link

Uncaught Error: Non-static method SizeLimitHelper::applyLimits() in modules/sizelimit/SetSizeOption.inc #134

Closed Filou83 closed 1 year ago

Filou83 commented 1 year ago

H Greg,

I get this error when I try to upload images from the local webserver:

Fatal error: Uncaught Error: Non-static method SizeLimitHelper::applyLimits() cannot be called statically in /gallery/modules/sizelimit/SetSizeOption.inc:91 Stack trace: #0 /gallery/modules/core/ItemAdd.inc(350): SetSizeOption->handleRequestAfterAdd(Array, Array) #1 /gallery/modules/core/ItemAdd.inc(166): ItemAddController->postprocessItems(Array, Array) #2 /gallery/modules/core/classes/GalleryTemplateAdapter.class(1091): ItemAddController->handleRequestWithProgressBar(Array, Object(GalleryAlbumItem), Object(ItemAddFromServer)) #3 /gallery2wallpaper/smarty/templates_c/%%1593485878/MBwallpaper/%%0C^0C0^0C0F6DAC%%theme.tpl.php(79): GalleryTemplateAdapter->trailer(Array, Object(GallerySmarty)) #4 /gallery/lib/smarty/Smarty.class.php(1255): include('/...') #5 /gallery/modules/core/classes/GallerySmarty.class(58): Smarty->fetch('gallery:themes/...', NULL, NULL, true) #6 /gallery/modules/core/classes/GalleryTemplate.class(241): GallerySmarty->fetch('gallery:themes/...', NULL, NULL, true) #7 /gallery/main.php(512): GalleryTemplate->display('gallery:themes/...') #8 /gallery/main.php(110): _GalleryMain(false) #9 /gallery/main.php(94): GalleryMain() #10 {main} thrown in /gallery/modules/sizelimit/SetSizeOption.inc on line 91

And I'm a bit lost fixing it... Do you have any idea fixing this issue?

Regards, Benny

Filou83 commented 1 year ago

I think I've fixed it by changing /modules/sizelimit/classes/SizeLimitHelper.class line 40 from function applyLimits(&$item, $operation, $args) { to static function applyLimits(&$item, $operation, $args) {

Maybe the other functions in this class also have to be static?

gregstoll commented 1 year ago

Hi! Yeah, this is a pretty common problem; I thought I had chased down all of these, but apparently not :-/ Let me take a look. Thanks for the report!