#1 2022-10-12 21:54:45

willem
Member
The Netherlands
2022-04-25
20

[13] Deprecated warning when adding comment

Hello/Hi/Greetings,

When somebody adds a comment to a picture this appears at the top of the page:

Code:

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/piwigolv/public_html/include/picture_comment.inc.php on line 34

Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /home/piwigolv/public_html/include/picture_comment.inc.php on line 36

Note: we enabled comments after the Piwigo 13 / PHP 8.1 upgrade, never used it before.

Code:

    Piwigo 13.0.0 Upgradecontrole
    Geïnstalleerd op 25 april 2022, 5 maanden 2 weken 3 dagen geleden
    Besturingssysteem: Linux
    PHP: 8.1.11 (Toon info) [2022-10-12 19:46:41]
    MySQL: 5.7.39 [2022-10-12 21:46:41]
    Afbeeldingen-bibliotheek: ImageMagick 7.1.0-20
    Cache grootte 681.98 Mo   berekend 5 uren geleden Ververs

Piwigo URL: https://beeldbank.lvbhb.nl/ (non-public)

Edit: this seems to PHP 8.1 related. The problem does not occur with PHP 8.0

Last edited by willem (2022-10-12 22:49:20)

Offline

 

#2 2022-10-13 04:08:20

Cadencia
Member
Auckland, New Zealand
2013-10-12
20

Re: [13] Deprecated warning when adding comment

These errors can be avoiding thus:

change /piwigo/include/picture_comment.inc.php lines 33 to 39 to check for empty strings thus:

$comm = array(
    'author' => empty(@$_POST['author']) ? '' : trim( @$_POST['author'] ),
    'content' => empty(@$_POST['content']) ? '' : trim( $_POST['content'] ),
    'website_url' => empty(@$_POST['website_url']) ? '' : trim( @$_POST['website_url'] ),
    'email' => empty(@$_POST['email']) ? '' : trim( @$_POST['email'] ),
    'image_id' => $page['image_id'],
   );

My environment is:
Environment
Piwigo 13.0.0 Check for upgrade
Installed on 26 November 2014, 7 years 10 months 2 weeks 3 days ago
Operating system: Linux
PHP: 8.1.2 (Show info) [2022-10-13 15:03:18]
MySQL: 8.0.30-0ubuntu0.22.04.1 [2022-10-13 15:03:18]
Graphics Library: ImageMagick 6.9.11-60
Cache size N/A   never calculated Refresh
Activated plugin list14
Admin Tools
AlwaysShowMetadata
Community
Exif View
Force HTTPS
Grum Plugins Classes.3
LocalFiles Editor
Manage Properties Photos
Menu Random Photo
Photo added by
PWG Stuffs
See photos by user
Take A Tour of Your Piwigo
user delete photo

Regards
Phil

Offline

 

Board footer

Powered by FluxBB

github linkedin newsletter Piwigo.org © 2002-2025 · Contact