ElkArte Community

Elk Development => Bug Reports => Topic started by: rjm on June 25, 2023, 11:10:59 am

Title: Cronjob to email_imap_cron.php yields error in v1.1.9
Post by: rjm on June 25, 2023, 11:10:59 am
Recently, a "custom" strftime()-function has been appended to Subs.php (because of "deprecated" state).
However, when the cronjob to email_imap_cron.php is executed, the following error is reported:

PHP Catchable fatal error:  Argument 1 passed to Util::strftime() must be an instance of string, string given, called in /var/www/virtual/prorad-dn.de/forum/htdocs/elk/sources/Subs.php on line 483 and defined in /var/www/virtual/prorad-dn.de/forum/htdocs/elk/sources/subs/Util.class.php on line 593

The git repo shows that Subs.php's last update was per commit of 2022-08-22. So I think that applying patch 1.1.10 would not fix this.
Title: Re: Cronjob to email_imap_cron.php yields error in v1.1.9
Post by: Spuds on June 27, 2023, 10:53:52 am
Thank you for the report !   I'll take a look
Title: Re: Cronjob to email_imap_cron.php yields error in v1.1.9
Post by: Spuds on June 30, 2023, 12:32:16 pm
I've not yet been able to track this down. 

Do you have the full trace in the error log?  I need to find where standardTime() was called from and how it has bad parameters. 

Was this a PBE topic reply, PM or a new topic?  Could you share the raw email (just need the headers) in case the email parser grabbed some incorrect date/time from the email.  Its probably going to be one of those easy to fix but hard to trace type of issues.

Also, thinking about this, what version of PHP are you running?
Title: Re: Cronjob to email_imap_cron.php yields error in v1.1.9
Post by: tino on July 02, 2023, 06:17:18 pm
Looking at the error that’s pre PHP 7.0. As that’s when string was added as a named type.
Title: Re: Cronjob to email_imap_cron.php yields error in v1.1.9
Post by: ahrasis on July 02, 2023, 09:39:56 pm
I think strftime()-function is deprecated in php8.1 so this may be new or overlooked.

This is some ideas to go about it: https://stackoverflow.com/questions/70930824/php-8-1-strftime-is-deprecated
Title: Re: Cronjob to email_imap_cron.php yields error in v1.1.9
Post by: tino on July 04, 2023, 04:24:54 pm
Quote from: ahrasis – I think strftime()-function is deprecated in php8.1 so this may be new or overlooked.

This is some ideas to go about it: https://stackoverflow.com/questions/70930824/php-8-1-strftime-is-deprecated

I introduced a function in Util to mitigate that, the function is what’s throwing the error.

The only way I can recreate it currently is by running PHP 5.6