phpList / phplist3

Fully functional Open Source email marketing manager for creating, sending, integrating, and analysing email campaigns and newsletters.
https://www.phplist.org
GNU Affero General Public License v3.0
737 stars 268 forks source link

PHP 8.2.5 & PHPlist 3.6.12: non numeric $timelapse get a "Division by zero" in processqueue.php #954

Closed enricozamprogno closed 1 year ago

enricozamprogno commented 1 year ago

``PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /var/www/html/bollettino/lists/admin/actions/processqueue.php:1224 Stack trace:

0 /var/www/html/bollettino/lists/admin/processqueue.php(22): include()

1 /var/www/html/bollettino/lists/admin/index.php(754): include('...')

2 {main}

thrown in /var/www/html/bollettino/lists/admin/actions/processqueue.php on line 1224

1223 $totaltime = $GLOBALS['processqueue_timer']->elapsed(1); 1224 $msgperhour = (3600 / $totaltime) * $counters['sent'];

PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /var/www/html/bollettino/lists/admin/actions/processqueue.php:262 Stack trace:

0 [internal function]: my_shutdown()

1 {main}

thrown in /var/www/html/bollettino/lists/admin/actions/processqueue.php on line 262"

260 $totaltime = $GLOBALS['processqueue_timer']->elapsed(1); 261 if ($totaltime > 0) { 262 $msgperhour = (3600 / $totaltime) * $counters['sent'];

timer Object $GLOBALS['processqueue_timer'] ( [start] => 1683886073329152 [previous] => 1683886073511945 )

totaltime=0,1828090000

As you see the the value returned by the method "elapsed" is a string rappresenting a float in italian locale ( with comma as decimal point ) and PHP don't get it in the division

enricozamprogno commented 1 year ago

the problem is in a sprintf in the method elapsed() og the class timer in admin/connect.php i have submitted a pull request "Update connect.php #956"