Not sure if this really belongs in bugz or not. emanuele will undoubtedly choose wisely. ;)
Anyway, when attempting to read PMs in 1.1.1 on php7.2, the following error occurs:
count(): Parameter must be an array or an object that implements Countable
Does it say also the file and the line of the error?
I can confirm, I have the same error. I try to give more information: I set PM as conversations, with PHP 7.1 I see all messages of the conversation, with PHP 7.2 I only see the first message of the conversation, and after that the error mentioned by
@badmonkey
I attach a couple of screenshots:
(Link-5348) (Link-5350) In elkarte log there is no error using php 7.1, with 7.2 I get:
Type of error: General
Warning: count(): Parameter must be an array or an object that implements Countable
http://...index.php?action=pm;pmid=2429;kstart;f=inbox;start=30;sort=date;asc
File: ...sources/controllers/PersonalMessage.controller.php
Line: 3094
I think the first count on that line isn’t required. Or at least that’s what’s throwing the error
I don't run PHP 7.2 yet, but I quickly looked through the relevant code and came up with the fix below.
https://github.com/elkarte/Elkarte/pull/3081/files
I lost the reply...
OMG again PMs... :'(
My eyes are already bleeding!! xD
haha
@badmonkey @radu81 did it work?
Thanks
@live627 , nothing changed, I still see the error
can you also add https://github.com/elkarte/Elkarte/pull/3081/commits/fa78e4b2db21ec6cdd7fe866a62839dfd831037f ?
If you use count on php7.* check is the $var a array with a simple is_array($var) ..
like if(is_array($var) && count($var) = 2)
Fel
I still see that error: count(): Parameter must be an array or an object that implements Countable
Confirmed the error persists.
Let's try this: in PersonalMessage.subs.php, find:
$message_labels = array();
and add after it:
foreach ($all_pms as $pmid)
{
$message_labels[$pmid] = array();
}
Yes, that works fine, thanks 8)
Still getting the error here. PHP 7.2.1, if that matters. ;)
Even applying all the changes suggested by live and me?
Applying the changes on github as well as the last change you posted, correct. Even emptied the cache.
Sanity check: I'll double check the edits later this morning to be absolutely certain I didn't goof. I've done dumber things. ;D
Update: another php restart did the trick! Thanks eman! ;)
@badmonkey could you please can you please check which line the error occurs?
ETA: seems I missed your last reply... :-[
hmm... interesting, maybe the opcache did not pick up the changes?
That was the running theory here as well. Thanks again for the help!
Does clearing the forum (not browser!) cache also invalidate the opcode cache?
Good question... I don't think so.
As far as I remember the only time opcache is invalidated is when writing to Settings.php... but I may be wrong.