#1 2023-05-03 12:49:07

nickO
Member
2021-01-11
30

Error: Deprecated: Function strptime() is deprecated in /app...

Hello all,

I have just set up mail and subscribers on my installation of Piwigo, but I receive the following error when sending mail to users:

Deprecated: Function strptime() is deprecated in /app/www/public/include/functions_notification.inc.php on line 604

This appears several times, above a message saying the mail has been sent (I checked, it has been sent). I'd appreciate any help in resolving this.

Thanks!
Nick.

Environment

    Piwigo 13.6.0 Check for upgrade
    Installed on 7 October 2022, 6 months 3 weeks 5 days ago
    Operating system: Linux
    PHP: 8.1.18 (Show info) [2023-05-03 11:47:21]
    MySQL: 10.6.12-MariaDB-log [2023-05-03 11:47:21]
    Graphics Library: ImageMagick 7.1.0-62
    Cache size 1312.81 Mo   calculated 4 weeks ago Refresh

Activated plugin list 7

    Community
    LocalFiles Editor
    OpenStreetMap
    Rotate Image
    Smilies Support
    Take A Tour of Your Piwigo
    VideoJS

Piwigo URL: https://piwigo.thecobwebs.duckdns.org

Offline

 

#2 2023-05-03 15:27:37

nickO
Member
2021-01-11
30

Re: Error: Deprecated: Function strptime() is deprecated in /app...

Well, I ended up fixing it by doing this:

erAck wrote:

You can suppress Deprecated messages by adding this to your local config (use [extension by Piwigo Team] LocalFiles Editor if you don't know how)

Code:

$conf['show_php_errors'] = E_ALL & ~E_DEPRECATED;

I got that from this thread (thank you): https://piwigo.org/forum/viewtopic.php?pid=178575

Nick.

Offline

 

#3 2023-05-03 18:29:35

k5
Member
2017-11-05
68

Re: Error: Deprecated: Function strptime() is deprecated in /app...

Hello
the strptime() function is deprecated since php 8.1  try replacing this with date_parse_from_format

include/functions_notification.inc.php
 

Code:

604   $exploded_date = date_parse_from_format($date, '%Y-%m-%d %H:%M:%S');
607  //$title .= ' ('.$lang['month'][1+$exploded_date['tm_mon']].' '.$exploded_date['tm_mday'].')';
612   if (!function_exists('date_parse_from_format'))
614   function date_parse_from_format($date, $fmt)
617   die('Invalid date_parse_from_format format '.$fmt);

Last edited by k5 (2023-05-03 18:29:53)

Offline

 

#4 2023-05-07 16:38:42

nickO
Member
2021-01-11
30

Re: Error: Deprecated: Function strptime() is deprecated in /app...

k5 wrote:

Hello
the strptime() function is deprecated since php 8.1  try replacing this with date_parse_from_format

include/functions_notification.inc.php
 

Code:

604   $exploded_date = date_parse_from_format($date, '%Y-%m-%d %H:%M:%S');
607  //$title .= ' ('.$lang['month'][1+$exploded_date['tm_mon']].' '.$exploded_date['tm_mday'].')';
612   if (!function_exists('date_parse_from_format'))
614   function date_parse_from_format($date, $fmt)
617   die('Invalid date_parse_from_format format '.$fmt);

Hi there, thank you for this.

Line 604 of my include/functions_notification.inc.php is below:

Code:

$exploded_date = strptime($date, '%Y-%m-%d %H:%M:%S');

So I change that line to:

Code:

$exploded_date = date_parse_from_format($date, '%Y-%m-%d %H:%M:%S');

?

Sorry, I know this is probably very obvious but I am new to this.

Thanks,
Nick.

Last edited by nickO (2023-05-07 16:39:04)

Offline

 

Board footer

Powered by FluxBB

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