SimplePortal

Support => English Support => Topic started by: phantomm on September 27, 2016, 12:47:42 PM

Title: Shoutbox does not load shouts in SMF 2.0.12
Post by: phantomm on September 27, 2016, 12:47:42 PM
I just updated my site with 2.0.12 patch and shouts are not visible in my shoutbox, error from log:
Code: [Select]
URL ?action=portal;sa=shoutbox;shoutbox_id=1;time=1474994634;xml
2: Invalid argument supplied for foreach()
File: Subs-Portal.php
Line: 1300
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: ccbtimewiz on September 27, 2016, 01:21:31 PM
Can you post your line 1300? Because it appears it doesn't have a foreach() there on a fresh copy of Subs-Portal.php
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: phantomm on September 27, 2016, 02:12:20 PM
Sorry, I forgot that I added something in this file, here is 1300 line and following code:
Code: [Select]
foreach ($shouts as $shout)
{
if (preg_match('~^@(.+?): ~' . ($context['utf8'] ? 'u' : ''), $shout['text'], $target) && $smcFunc['strtolower']($target[1]) !== $smcFunc['strtolower']($user_info['name']) && $shout['author']['id'] != $user_info['id'] && !$user_info['is_admin'])
{
unset($shouts[$shout['id']]);
continue;
}

$shouts[$shout['id']] += array(
'is_me' => preg_match('~^<div\sclass="meaction">\* ' . preg_quote($shout['author']['name'], '~') . '.+</div>$~', $shout['text']) != 0,
'delete_link' => $can_delete ? '<a href="' . $scripturl . '?action=portal;sa=shoutbox;shoutbox_id=' . $shoutbox . ';delete=' . $shout['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '">' . sp_embed_image('delete_small') . '</a> ' : '',
'delete_link_js' => $can_delete ? '<a href="' . $scripturl . '?action=portal;sa=shoutbox;shoutbox_id=' . $shoutbox . ';delete=' . $shout['id'] . ';' . $context['session_var'] . '=' . $context['session_id'] . '" onclick="sp_delete_shout(' . $shoutbox . ', ' . $shout['id'] . ', \'' . $context['session_var'] . '\', \'' . $context['session_id'] . '\'); return false;">' . sp_embed_image('delete_small') . '</a> ' : '',
);

$shouts[$shout['id']]['text'] = str_replace(':jade:', '<img src="http://www.simpleportal.net/sp/cheerleader.gif" alt="Jade!" />', $shouts[$shout['id']]['text']);
$shouts[$shout['id']]['time'] = timeformat($shouts[$shout['id']]['time']);
$shouts[$shout['id']]['text'] = preg_replace('~(</?)div([^<]*>)~', '$1span$2', $shouts[$shout['id']]['text']);
$shouts[$shout['id']]['text'] = preg_replace('~<a([^>]+>)([^<]+)</a>~', '<a$1' . $txt['sp_link'] . '</a>', $shouts[$shout['id']]['text']);
$shouts[$shout['id']]['text'] = censorText($shouts[$shout['id']]['text']);

if (!empty($modSettings['enable_buddylist']) && !empty($options['posts_apply_ignore_list']) && in_array($shout['author']['id'], $context['user']['ignoreusers']))
$shouts[$shout['id']]['text'] = '<a href="#toggle" id="ignored_shout_link_' . $shout['id'] . '" onclick="sp_show_ignored_shout(' . $shout['id'] . '); return false;">[' . $txt['sp_shoutbox_show_ignored'] . ']</a><span id="ignored_shout_' . $shout['id'] . '" style="display: none;">' . $shouts[$shout['id']]['text'] . '</span>';
}

it's in function sportal_get_shouts
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 27, 2016, 02:35:56 PM
I uninstalled the 2.0.12 patch and it's working fine again. I hope this is an easy fix.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: emanuele on September 27, 2016, 06:17:58 PM
No idea what was changed, but at the moment I can't reach sm.org, so I can't even download the package...
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 28, 2016, 06:30:57 AM
I can get to them so you should try again.

By the way, if you enter anything in the Shoutbox then it repopulates and then disappears again after a page load/reload.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: emanuele on September 28, 2016, 08:32:43 AM
Try two things:
1) disable the cache,
2) clean up the SMF cache (from maintenance IIRC). I feel there is some difference in the handling of the charsets.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 28, 2016, 09:29:03 AM
i disabled the SMF cache before applying 2.0.12 and it worked so i enabled it and it worked first time but then failed again on page reload.

i also cleared the SMF cache and it looked good until i reloaded the page.

Usually i see 2 errors stating "Invalid argument supplied for foreach()" in /var/www/html/Sources/Subs-Portal.php

BUT disabling the SMF cache fixes the problem ! but i don't want to do that.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: obcy on September 28, 2016, 09:42:43 AM
If the cache is turned off completely it works. If enabled, the cache is only one works.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 28, 2016, 09:46:58 AM
If i turn OFF the Shoutbox cache then it also works with SMF's cache set to 1.

I tried to Delete all shouts and it worked for a while until my window filled up but the problem came back.

the one thing that fixes it is turning the Shoutbox cache off so maybe there is a logic error in how the Shoutbox caches ?

... and does it really matter if i turn off the Shoutbox cache ?
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: emanuele on September 28, 2016, 11:01:44 AM
The logic is that the new function introduce to unserialize strings messes with the charsets.
Most likely, the serialize function uses a certain charset, while the unserialize another.

Try this, in Load.php, find:
Code: [Select]
$value = $value === null ? null : serialize($value);replace with:
Code: [Select]
$value = $value === null ? null : safe_serialize($value);and enable the cache.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 28, 2016, 12:08:26 PM
sorry to say but that made no difference. i had the Shoutbox cache enabled prior to making the change to Load.php but when i logged on, i still get "There aren't any shouts yet!"

I have now undone the change to Load.php
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: phantomm on September 28, 2016, 01:05:05 PM
I can only confirm that this fix does not help with this issue and Shoutbox works only when cache is disabled - sometimes it works even with forum cache level 1 but eventually it will crash anyway

Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 28, 2016, 02:22:51 PM
any more thoughts on this matter ? ... here is the Changelog, FYI

SMF 2.0.12 Changelog                                              July 7, 2016
===============================================================================
 ! Fixed word censor injection by disallowing an empty 'proper word'
 ! Fixed vulnerable unserialize() code by converting all instances to safe_unserialize()
 ! Added a more thorough safe_unserialize() function to prevent object injection
 ! Fixed a bug where leaving a custom profile field blank on registration that has an email mask would throw an error
 ! Fixed PayPal integration to comply with the new forced SSL
 ! Fixed a bug where notifications were sent for messages in inaccessible boards
 ! Fixed editor to make the editor work with Microsoft Edge
 ! Fixed issue where smiley popup is blank on iOS 9 devices
 ! Fixed WYSIWYG editor in mobile devices
 ! Fixed an undefined $_POST['icon'] in Sources/Post.php
 ! Fixed a minor bug in Login2()
 ! Fixed an issue where SMF doesn't recognize new domain names and considers these as invalid
 ! Fixed an issue where SMF would allow empty BBC
 ! Fixed an issue where theme variants could not be selected
 ! Fixed an issue where the file version of Subs-Post.php could have been 2.0.8 or 2.0.11. It will be updated to 2.0.12 in either case.
 ! Updated copyright year to 2016
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: emanuele on September 28, 2016, 02:53:30 PM
Let's do another thing:
1) enable the cache,
2) write a couple of messages in the shout,
3) identify the shoutbox cache file,
4) download it, zip it and attach it here.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: phantomm on September 28, 2016, 03:00:01 PM
but with 2.0.11?
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 28, 2016, 03:02:37 PM
Let's do another thing:
1) enable the cache,
2) write a couple of messages in the shout,
3) identify the shoutbox cache file,
4) download it, zip it and attach it here.

I chose to "cat data_c304fca73aa82b36cce172d762edd34b-SMF-shoutbox_shouts-1.php" instead. Here is the output whilst the problem persists:

Code: [Select]
<?php if (!defined('SMF')) die; if (1475089568 time()) $expired true; else{$expired false$value 'a:17:{i:3507;a:4:{s:2:"id";s:4:"3507";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 02:04:53 PM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475078693";s:4:"text";s:372:"x<script type="text/javascript">function spSound(){var beep = document.getElementById("beep");beep.play(1);}</script><object id="beep" type="application/x-shockwave-flash" data="Themes/default/images/sp/shout_sounds.swf" width="0" height="0"><param name="movie" value="Themes/default/images/sp/shout_sounds.swf" /><param name="FlashVars" value="onLoad=spSound" /></object>";}i:3506;a:4:{s:2:"id";s:4:"3506";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 12:05:48 PM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475071548";s:4:"text";s:1:"x";}i:3505;a:4:{s:2:"id";s:4:"3505";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 12:05:14 PM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475071514";s:4:"text";s:2:"44";}i:3504;a:4:{s:2:"id";s:4:"3504";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 12:05:11 PM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475071511";s:4:"text";s:2:"33";}i:3503;a:4:{s:2:"id";s:4:"3503";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 12:05:07 PM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475071507";s:4:"text";s:2:"22";}i:3502;a:4:{s:2:"id";s:4:"3502";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 12:05:01 PM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475071501";s:4:"text";s:2:"11";}i:3501;a:4:{s:2:"id";s:4:"3501";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 11:55:00 AM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475070900";s:4:"text";s:2:"10";}i:3500;a:4:{s:2:"id";s:4:"3500";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 11:54:57 AM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475070897";s:4:"text";s:1:"9";}i:3499;a:4:{s:2:"id";s:4:"3499";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 11:54:22 AM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475070862";s:4:"text";s:69:"<span style="background-color: yellow;" class="bbc_color">test</span>";}i:3498;a:4:{s:2:"id";s:4:"3498";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 11:52:56 AM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475070776";s:4:"text";s:1:"8";}i:3497;a:4:{s:2:"id";s:4:"3497";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 11:52:53 AM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475070773";s:4:"text";s:1:"7";}i:3496;a:4:{s:2:"id";s:4:"3496";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 11:52:50 AM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475070770";s:4:"text";s:1:"6";}i:3495;a:4:{s:2:"id";s:4:"3495";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 11:52:47 AM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475070767";s:4:"text";s:1:"5";}i:3494;a:4:{s:2:"id";s:4:"3494";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 11:52:44 AM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475070764";s:4:"text";s:1:"4";}i:3493;a:4:{s:2:"id";s:4:"3493";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 11:49:29 AM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475070569";s:4:"text";s:1:"3";}i:3492;a:4:{s:2:"id";s:4:"3492";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 11:49:24 AM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475070564";s:4:"text";s:1:"2";}i:3491;a:4:{s:2:"id";s:4:"3491";s:6:"author";a:4:{s:2:"id";s:1:"2";s:4:"name";s:7:"chipper";s:4:"link";s:126:"<a href="http://192.168.0.180/index.php?action=profile;u=2" title="on Today at 11:49:20 AM" style="color: purple;">chipper</a>";s:5:"color";s:6:"purple";}s:4:"time";s:10:"1475070560";s:4:"text";s:1:"1";}}';}?>
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: phantomm on September 28, 2016, 03:06:04 PM
here is file from 2.0.12 when I enabled Shoutbox cache and shouts are not visible
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: emanuele on September 28, 2016, 05:02:16 PM
I chose to "cat data_c304fca73aa82b36cce172d762edd34b-SMF-shoutbox_shouts-1.php" instead.
The problem is that pasting it I'm cannot be sure what SMF did to the characters, I cannot trust that output to investigate if the variable is properly serialized or not.
I'll check anyway and maybe I'm lucky, but phantomm's zip is much more reliable in that respect. ;)
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: emanuele on September 28, 2016, 05:10:32 PM
Would you mind check the XML response when the shoutbox is refreshed? (I mean with the browser's developer tool.)
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 28, 2016, 06:52:11 PM
I chose to "cat data_c304fca73aa82b36cce172d762edd34b-SMF-shoutbox_shouts-1.php" instead.
The problem is that pasting it I'm cannot be sure what SMF did to the characters, I cannot trust that output to investigate if the variable is properly serialized or not.
I'll check anyway and maybe I'm lucky, but phantomm's zip is much more reliable in that respect. ;)

I see. It just looked like the human-readable text of a block of php code to my untrained eye. Sorry about that.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: ♦ Ninja ZX-10RR ♦ on September 28, 2016, 09:34:57 PM
Deleted the other thread as requested, you can continue here with info and stuff.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: emanuele on September 29, 2016, 07:54:44 AM
Just to be sure it was read:
Would you mind check the XML response when the shoutbox is refreshed? (I mean with the browser's developer tool.)
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 29, 2016, 11:13:26 AM
I wonder why it's only 2 of us that have reported this ?

Could it be our unique configuration of mods ?

Have you tried to recreate it on one of your test systems ?
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: ♦ Ninja ZX-10RR ♦ on September 29, 2016, 03:40:31 PM
Please reply to emanuele's question, the poor guy asked it twice already, don't make him mad ;D (jk)

Would you mind check the XML response when the shoutbox is refreshed? (I mean with the browser's developer tool.)
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 29, 2016, 08:33:37 PM
I'm not sure how to do this ?

Do you want us to view the returned page's source HTML and if so, what do I look for ?

Forgive me but I am relatively new to all this.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: phantomm on September 30, 2016, 12:23:27 AM
@Emanuele I'll do it today after work, somehow I didn't noticed first message
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 30, 2016, 02:08:08 AM
if anyone can tell me how to do this, then i'd be grateful. i can access the Dev tools in Chrome but need specific instructions.

What am i looking for ? or is it going to take too long to step me through ?

i've Google searched on "XML response" but i still can't figure out what emmanual wants to know other than "some return code" from when the shouts cache file (that is the result of serialization?) isn't processed correctly.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: FLHS on September 30, 2016, 02:55:29 AM
I wonder why it's only 2 of us that have reported this ?

I've the same issue on my test- and my livesystem.
So I follow this thread very closely.

And also with me it's a cache issue.
If I switch off caching (APC installed), everything runs fine.

Jens
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 30, 2016, 03:03:05 AM
* another symptom:

i tried again by deleting all the shouts via "prune" and it works perfectly well UNTIL the window fills up and that alone triggers the problem, too.

is that an issue with scrolling, (also?) perhaps ?

Hey, I saw this:

Seems to be a bug with the new serialise method and the length. as mentioned by somebody on the SMF site about 2.0.12. see http://www.simplemachines.org/community/index.php?topic=548902.msg3893084#msg3893084

it may be SMF's problem so keep an eye on the SMF Support Board too before you start getting frustrated.

i added a post to the above SMF thread so they can see that it's affecting SimplePortal, also.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: phantomm on September 30, 2016, 12:56:56 PM
every time XML response is:
Code: [Select]
<smf>
<shoutbox>
1
</shoutbox>
<updated>
0
</updated>
</smf>

it's with and without cache


/edit:

this tip from vbgamer45 seems to fix it for me:
http://www.simplemachines.org/community/index.php?topic=548944.msg3893213#msg3893213

but would it be permanent fix for issue?
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: Sages on September 30, 2016, 02:12:09 PM
Dear phantomm,

Where this piece of code is?
Since i am experiencing the same bug on my forum, i would like to test it.

Thank You
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: phantomm on September 30, 2016, 02:40:33 PM
Subs.php
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: Sages on September 30, 2016, 03:20:34 PM
I can confirm it works for me as well... But i would say it's only a workaround..
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on September 30, 2016, 06:37:25 PM
the fix does NOT work for me at all as i made a change to Subs.php, as requested but the page reload loses the data again.

i double checked Subs.php and i have definitely commented out the length test.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on October 01, 2016, 02:17:42 AM
I also tried it on my QAT (Quality Assurance) system which only has a few critical mods like Simple Portal, made the change to Subs.php and that worked but only until i refreshed the database only and then it failed.

So perhaps it's another mod that's causing this somehow ?

If there is anything that you want me to do to debug this (trace ? the XML response (stop me through)) then i will I would be very happy to oblige - this is the only thing stopping me from moving to 2.0.12 and it's really bugging me.

I know that i can just turn off the SP Shoutbox cache but i'm keen to understand exactly why this doesn't work for just me ... however, i don't want you to waste too much of your unpaid your time on me either so if you think i should just turn off the cache then i will do do so.

Sorry to be such a headache !
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: ♦ Ninja ZX-10RR ♦ on October 01, 2016, 11:50:06 AM
Don't worry aegersz, you're not an headache, you're giving us useful information that may help emanuele to figure out what goes wrong :) If you were an headache, we'd have let you know :P
I am not good enough to figure out what the problem is, so I can just hope emanuele will.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on October 01, 2016, 05:21:52 PM
thanks. i now don't think that he has to as Arantor from SMF said this:

Quote
if you have no compatible accelerator, it will fall back to the file cache. Which is where the problem is due to the serialise routine used by the cache and specifically the (new) unserialise routine deciding that there's too much data and just dropping it.

the interesting this is sometimes it works after you make a change like taking off a Shoutbox mod or refreshing the files and database (test system) then fails again. I am now convinced that it's not a Simple Portal problem so we should wait for SMF Support.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: Chen Zhen on October 02, 2016, 12:43:54 AM
It's a glitch in my "Extra Shoutbox Permissions/Options" SP plugin.

I will fix the issue and post a newer version.
In the mean time just disable the cache on the shoutbox as you described.

Regards.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: phantomm on October 02, 2016, 03:56:29 AM
I don't have this mod installed on my forum (extra sb permissions) and still have this issue
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: rentner on October 02, 2016, 04:09:04 AM
FYI

I have the same problem with the shoutbox cache after the update 2.0.12, I'm grateful on a buck fixing for this problem.

If I just have disabled the cache for the shoutbox (and it function) but get this message in the error log:


8192: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead
Datei: /..../forum/Sources/PortalBlocks.php
Zeile: 2028
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on October 02, 2016, 06:45:14 AM
I don't have the extra options for Shoutbox on either and I still get the error too.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: Chen Zhen on October 02, 2016, 08:36:07 PM
Oh??
I was testing this last night and it seemed to work without the plugin.
After I installed the plugin the issue occurred.
Perhaps if I had tested it longer using more shouts without the plugin..

Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: Chen Zhen on October 02, 2016, 08:42:00 PM
rentner,

You were given a fix for that some time ago:
http://simpleportal.net/index.php?topic=10356.msg68208#msg68208

... also if that error is recurring then I will assume your Simple Portal version is not up to date on what you are displaying.
Download & use the 2.3.6 version from the download link (stable packages) at the top of the forum.

.. although when I just checked your live forum it shows as sp 2.3.6 ??
is this your live forum that the error is showing on or some sort of local/alternate test site?
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: Chen Zhen on October 03, 2016, 12:13:17 AM

If it is not a bother, please test a default installation of Simple Portal (no plugins) replace the Subs-Portal.php Sources folder attached to this post.
Let me know if it seems to fix the issue.

@aegersz,
Thanks for the quote from Arantor.. spot on about the lengthy array.

.. I did not test this with various scenarios as of yet.
ie. multiple shoutboxes on the same page and such.

Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: rentner on October 03, 2016, 05:42:36 AM
rentner,

You were given a fix for that some time ago:
http://simpleportal.net/index.php?topic=10356.msg68208#msg68208

... also if that error is recurring then I will assume your Simple Portal version is not up to date on what you are displaying.
Download & use the 2.3.6 version from the download link (stable packages) at the top of the forum.

.. although when I just checked your live forum it shows as sp 2.3.6 ??
is this your live forum that the error is showing on or some sort of local/alternate test site?

Yes of course, sorry you be right, this fixed this problem. I had reinstalled the SP 2.3.6 after the cache problems with SF 2.0.12 and the PortalBlocks.PHP was overwritten again. Now this error message is fix again.

Thanks

PS: Are there any problems expected after disable cache of the shouldbox?
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: phantomm on October 04, 2016, 04:06:27 PM
I can't test this file, because forum is too active right now (I'm using it for few domains with Split Forum Mod), but I did noticed that issue affects shoutbox with lots of messages - new shoutbox is not affected, only problem is with shoutbox with over 169331 messages

and I think that SMF team is aware that there is bug in latest release:
Quote from: nend
As far as the issue, there was a problem with the release and an older revision got released instead of the actual 2.0.12 we had planned. Rest assure we are working on getting the correct revision out soon.

http://www.simplemachines.org/community/index.php?topic=548944.msg3893693#msg3893693
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: Chen Zhen on October 04, 2016, 04:23:25 PM
The file I posted does not correct the issue.
I was testing it yesterday and its not using the cache properly.
The right idea is there but I did not code it correctly as of yet.
Hopefully a corrected release of SMF will fix the issue else I will mess with it some more to get it working properly.
All one has to do is split up the $shouts array prior to storing it in the cache.. decreasing the length of what is being stored at one time.
Imo in theory it should work.
 
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: Chen Zhen on October 05, 2016, 10:29:55 PM

Here is a new file to test on a default Simple Portal 2.3.6 installation.
Please test this for SP 2.3.6 & SMF 2.0.12
Let me know of any issues.

 
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: andy on October 06, 2016, 05:46:14 AM
So far, with limited testing, this file works for me.

Hope a new update of SP will be released to make it easier for people.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: emanuele on October 08, 2016, 05:44:10 PM
I have the feeling what you are doing is worse than disable the cache entirely.

Storing each and every shout in its own file means that for each and every shout you are opening a file on the disk.
I would be surprised if this scenario has any benefit when using the file-based cache (probably 95% of SMF/SP install-base).
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: Chen Zhen on October 09, 2016, 05:29:27 PM

Yes you're right; it makes way too many files doing it that way.
Imo the only other alternative to no cache (using the db) is to create a temporary txt file which is essentially a custom cache.
If SMF 2.0.13 behaves the same can you think of another alternative other than that?
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: raffo on November 06, 2016, 03:04:21 PM
How is possible to disable the cache just for the shoutbox?
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: ccbtimewiz on November 11, 2016, 12:09:22 AM
The solution to this is to completely ignore SMF's internal caching system. SP shouldn't even be using it for the shoutbox.

In Subs-Portal.php, you should add two new functions:

sp_shout_cache_put()
sp_shout_cache_get()

Both would have $shout, $time, $type. I thought about having a $duration or something, but both should be hard coded to 60 minutes. Could pass it to SMF itself and have it as an option in the SP admin settings (cache duration) in minutes.

$shout would be the shout itself, serialized of course and stripped of special characters. Probably could use $smcFunc for it.

$time would be the time the shout was made, preferably in server time. Not sure if SMF has a server_time() function or if its in $smcFunc, could just use time() I guess.

$type is not very important to have. "0" would be standard shout, "1" could be an important message that always appears first or something, if you ever have plans on expanding the shoutbox. "2" could be a moderator shout that persists for an amount of time, or you could even make it so $type is either "allowed" or "banned", or something.

I'm a fan of both a database-based cache and a harddisk file based cache. You can have it output a .php file and put a die() or something if its accessed directly. And then have the entire PHP file just be like a text file. This way people who know the software won't have access to a ton of SP shoutbox caches.

File could be something like sp_shout_cache.php and it could look something like;

Code: [Select]
<?php

/*
Simple Portal Shoutbox Cache
THIS FILE IS AUTOMATICALLY GENERATED
*/


if (!
defined('SMF'))
die('Hacking attempt...');

function 
sp_cached_shouts()
{
// this array stores all the shouts used for the cache
$shouts = array();

// each shout increments the array
$shout[] = array(1'Sayaka''This is a shout!''11102016115933');
$shout[] = array(1'Sayaka''I love talking to myself''11102016115937');
$shout[] = array(1'Sayaka''Yeah it\'s pretty interesting''11102016115939');
$shout[] = array(1'Sayaka''You don\'t say?''11102016115953');

// if there are no shouts, it will always return empty
return $shouts;
}

?>

sp_shout_cache_put() would write shouts with the proper information to this file. It would use fwrite() and write to the file locally. For the pointer, it would look for the comment "// each shout increments the array" and then it increments from there since the array is being appended each time.

sp_shout_cache_get() would be a bit easier because we wrote the cache file to php and it already returns an array. So you can call the file and then use sp_cached_shouts. The reason we just don't call it directly via an include is so we can do some work beforehand, like checking times or cleaning the shouts.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: raffo on November 13, 2016, 06:23:31 AM
To make a resume: what is a friendly solution for a common user who doesn't know and manage the php code very well (I can insert code and modify, but low profile)?
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: emanuele on November 13, 2016, 07:36:15 AM
Disable the caching.
That anyway is mostly pointless unless you have a **very** busy forum (I wouldn't even consider the "very crappy host" position, because in that case you'll likely use a file-based cache, and that would be even detrimental in comparison to the no-cache option).
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: newtoallthis on November 25, 2016, 04:25:09 PM
I uninstalled the 2.0.12 patch and it's working fine again. I hope this is an easy fix.

Just got this from SMF.

Go back to 2.0.11
They are working on a patch for this in 2.0.13
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: aegersz on January 12, 2017, 01:39:09 AM
2.0.13 patch is out now.

I did try it on my test system but I see to have the same problem as documented here.

BUT if i prune my Shoutbox then it all works. Cool, i i sacrifice my chat log if need be.

Note: clearing the forum cache (as mentioned below) did not work for me.
Title: Re: Shoutbox does not load shouts in SMF 2.0.12
Post by: phantomm on January 14, 2017, 08:06:15 PM
for everyone else - after update to 2.0.13 clear your forum cache and shoutbox will work just fine :)
SimplePortal 2.3.8 © 2008-2024, SimplePortal