V. 3.6.10 with PHP 8.0.x Problems?

After changing the PHP-Version to 8.0.x PHPList doesn’t work.
I send the Newsletter per Web-Interface and after 1 Mail PHPList is done.

PHP-Error-LOG:
PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /lists/admin/actions/processqueue.php:1328\nStack trace:\n#0 /lists/admin/pageaction.php(20): include()\n#1 /lists/admin/index.php(754): include(’/is/htdocs/wp11…’)\n#2 {main}\n thrown in /lists/admin/actions/processqueue.php on line 1328

PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /lists/admin/actions/processqueue.php:262\nStack trace:\n#0 [internal function]: my_shutdown()\n#1 {main}\n thrown in /lists/admin/actions/processqueue.php on line 262

@email71272 Going by the line numbers shown this is the line of code that is failing, the last line.
$counters['sent'] must be 0. But that is executed only when the $counters['sent'] > 0 so this doesn’t seem to make sense.

    if ($counters['sent'] > 0) {
        $msgperhour = (3600 / $totaltime) * $counters['sent'];
        $secpermsg = $totaltime / $counters['sent'];

Does this repeatedly happen?

I don’t know what you mean with repeatedly.

The same code ist in line 262 & 1328.
After restarting the queue phpList sents always only 1 mail.

That is what I meant.
Have you changed the source code in the file admin/actions/processqueue.php because the second fatal error seem to be referring to a different variable?

No, I don’t make any chances. This is an original Installation.

@email71272 To try to work-around the problem you could try editing the file admin/actions/processqueue.php

line 1328 is

        $secpermsg = $totaltime / $counters['sent'];

replace that by

        $secpermsg = 1;

That will probably make the phplist sending rate statistics not be correct but might avoid the problem.

It doesn’t work.

I also delete this line as in line 1229.
No more errormessages in the logfile, but the problem is still alive.

@email71272

but the problem is still alive.

What do you mean by this?

Try enabling verbose logging by phplist by adding or changing this line in the config.php file. Then look at the Event Log page after processing the queue to see any extra output

define('VERBOSE', 1);

The same errors:

PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /newsletter/lists/admin/actions/processqueue.php:1328\nStack trace:\n#0 /newsletter/lists/admin/pageaction.php(20): include()\n#1 /newsletter/lists/admin/index.php(754): include(’/is/htdocs/wp11…’)\n#2 {main}\n thrown in newsletter/lists/admin/actions/processqueue.php on line 1328

PHP Fatal error: Uncaught DivisionByZeroError: Division by zero in /newsletter/lists/admin/actions/processqueue.php:262\nStack trace:\n#0 [internal function]: my_shutdown()\n#1 {main}\n thrown in /newsletter/lists/admin/actions/processqueue.php on line 262

@email71272 Sorry but I don’t understand what is happening. Can you revert to using whichever version of php was working before?

No. PHP 7.4.x is EOL.

@email71272 Yes but at least it works. Or use php 8.1 which is the latest major version and works fine for me.

Otherwise you will have to try to debug what is happening. Line 1328 should not have a divide by zero so I cannot see why it is happening.

I tested PHP 8.1 and it doesn’t work, too.
Perhaps, there’s a problem with some misconfiguration in php.ini with this hoster/provider. I don’t know.

THX for your help.

same problem > phpList 3.6.10 / php 8.x
Provider strato/hosteurope

Hi!
I have the same error with provider being Strato. I am pretty sure it is not the line
“$secpermsg = $totaltime / $counters[‘sent’];”
but instead the line
“$msgperhour = (3600 / $totaltime) * $counters[‘sent’];”.
This is line 1327 in the original code - maybe email71272 has added a line above.
It seems that the line
“$totaltime = $GLOBALS[‘processqueue_timer’]->elapsed(1);”
does not work as expected which also explains the error in line 262 (a division by $totaltime, as well).
I also noticed a warning about a non-numeric value. Could that be?

Please can you show that?
There might be a problem with calculating the total time if two readings are made in the same microsecond.

Can you try to debug this by inserting this before line 261 and also before 1326

var_dump([$counters['sent'], $totaltime]);

That should get displayed, but if you get a “white page” then try looking at the html source.

I get the same problem (at the same hosting company, hosteurope) and so I can report that inserting those two lines in processqueue.php displays nothing.

Here is what I get in the message window:

Processing queued campaigns
Please wait, processing your request

Giving a UUID to 3 subscribers, this may take a while
Maximum time for queue processing: 60
Started
select id from phplist_message where status not in (“draft”, “sent”, “prepared”, “suspended”) and embargo <= now() order by entered limit 5
Processing has started,
One campaign to process.
Please leave this window open. phpList will process your queue until all messages have been sent. This may take a while
Report of processing will be sent by email
sending of this campaign will stop, if it is still going in 6 days 23 hours 59 mins 29 secs
Processing message 2
Looking for users
User select query select distinct u.id from phplist_listuser as listuser
inner join phplist_user_user as u ON u.id = listuser.userid
inner join phplist_listmessage as listmessage ON listuser.listid = listmessage.listid
left join phplist_usermessage as um ON (um.messageid = 2 and um.userid = listuser.userid)
where
listmessage.messageid = 2
and listmessage.listid = listuser.listid
and u.id = listuser.userid
and um.userid IS NULL
and u.confirmed and !u.blacklisted and !u.disabled
Found them: 4 to process
Sending 2 to ab.c@xxx.yy
It took 0,0898380000 seconds to send

Sending in batches of 1,000 emails
Script stage: 5

I have set

$er = error_reporting(E_ALL);

in lists/index.php and /admin/index.php

error_reporting(E_ALL);

in /admin/init.php

define(‘VERBOSE’, true);

in config.php

We skipped over php8 opting instead to go straight to php8.1 and have had no problems with phpList at all. So, if that is an option for you, I would suggest making the hop.

Doug

@freddy Can you try making the change in this pull request, to see whether that makes any difference

I solved the issue with a combination of measures:

  1. mark all active messages that have been submitted but not sent properly as sent.

  2. in phpadmin make a change to the database.
    2.1. select phplist_sendprocess and delete all lines that show up.

  3. make the change in line 1326 of actions/processqueue.php ( Avoid possible divide by zero when calculating message send rate #925 ), as suggested above by Duncan.

  4. in admin/connect.php replace

%0.10f

by

%0.10F

as suggested in #2 of Campaign stops after 1 email if language is not englisch