1 (edited by KamWest 2021-04-12 18:23)

Topic: Error Log

[12-Apr-2021 15:48:50 UTC] PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /home/doca6413/public_html/include/parser.php(750) : eval()'d code on line 76

Here is what the file looks like

https://i.postimg.cc/WzTYbVfv/Picture0051.png


Any idea what is causing this error? it is logged hundreds of times

Re: Error Log

You are looking at the error in the wrong place.
It is necessary to look at the 750 line of the parser.php file. It contains a call to a hook via the eval() function.
See the name of the hook, look among the installed extensions for the extension that adds code to this hook. Look for the error in this code.

ForkBB
I speak only Russian  :P

Re: Error Log

Line 750 starts with

$return = ($hook = get_hook('ps_do_bbcode_start')) ? eval($hook) : null;
    if ($return !== null)
        return $return;

The whole section of code looks like this...

//
// Convert BBCodes to their HTML equivalent
//
function do_bbcode($text, $is_signature = false)
{
    global $lang_common, $forum_user, $forum_config;

    $return = ($hook = get_hook('ps_do_bbcode_start')) ? eval($hook) : null;
    if ($return !== null)
        return $return;

    if (strpos($text, '[quote') !== false)
    {
        $text = preg_replace_callback(
            '#\[quote=(&\#039;|"|"|\'|)(.*?)\\1\]#', function($matches) {
global $lang_common;
return '</p><div class="quotebox"><cite>'.str_replace(array('[', '"'), array('&#91;', '"'), $matches[2])." ".$lang_common['wrote'].":</cite><blockquote><p>";
},
$text);
        $text = preg_replace('#\[quote\]\s*#', '</p><div class="quotebox"><blockquote><p>', $text);
        $text = preg_replace('#\s*\[\/quote\]#S', '</p></blockquote></div><p>', $text);
    }

    if (!$is_signature)
    {
        $pattern_callback[] = '%\[list(?:=([1a*]))?+\]((?:(?>.*?(?=\[list(?:=[1a*])?+\]|\[/list\]))|(?R))*)\[/list\]%is';
        $replace_callback[] = 'handle_list_tag($matches[2], $matches[1])';
    }

    $pattern[] = '#\[b\](.*?)\[/b\]#ms';
    $pattern[] = '#\[i\](.*?)\[/i\]#ms';
    $pattern[] = '#\[u\](.*?)\[/u\]#ms';
    $pattern[] = '#\[colou?r=([a-zA-Z]{3,20}|\#[0-9a-fA-F]{6}|\#[0-9a-fA-F]{3})](.*?)\[/colou?r\]#ms';
    $pattern[] = '#\[h\](.*?)\[/h\]#ms';

    $replace[] = '<strong>$matches[1]</strong>';
    $replace[] = '<em>$matches[1]</em>';
    $replace[] = '<span class=\"bbu\">$matches[1]</span>';
    $replace[] = '<span style=\"color: $matches[1]\">$matches[2]</span>';
    $replace[] = '</p><h5>$matches[1]</h5><p>';

    if (($is_signature && $forum_config['p_sig_img_tag'] == '1') || (!$is_signature && $forum_config['p_message_img_tag'] == '1'))
    {
        $pattern[] = '#\[img\]((ht|f)tps?://)([^\s<"]*?)\[/img\]#';
        $pattern[] = '#\[img=([^\[]*?)\]((ht|f)tps?://)([^\s<"]*?)\[/img\]#';
        if ($is_signature)
        {
            $replace[] = '".handle_img_tag($matches[1].$matches[3], true)."';
            $replace[] = '".handle_img_tag($matches[2].$matches[4], true, $matches[1])."';
        }
        else
        {
            $replace[] = '".handle_img_tag($matches[1].$matches[3], false)."';
            $replace[] = '".handle_img_tag($matches[2].$matches[4], false, $matches[1])."';
        }
    }

    $text = preg_replace_callback('#\[url\]([^\[]*?)\[/url\]#', 'callback_handle_url_nobb', $text);
    $text = preg_replace_callback('#\[url=([^\[]+?)\](.*?)\[/url\]#', 'callback_handle_url_nobb', $text);

    $pattern[] = '#\[email\]([^\[]*?)\[/email\]#';
    $pattern[] = '#\[email=([^\[]+?)\](.*?)\[/email\]#';

    $replace[] = '<a href=\"mailto:$matches[1]\">$matches[1]</a>';
    $replace[] = '<a href=\"mailto:$matches[1]\">$matches[2]</a>';

    $return = ($hook = get_hook('ps_do_bbcode_replace')) ? eval($hook) : null;
    if ($return !== null)
        return $return;

    $count = count($pattern);
    for ($i = 0; $i < $count; $i++) {
        $text = preg_replace_callback($pattern[$i], function($matches) use ($replace, $i) {
                return eval('return "'.$replace[$i].'";');
            }, $text);
    }
    
    $count = count($pattern_callback);
    for ($i = 0; $i < $count; $i++) {
        $text = preg_replace_callback($pattern_callback[$i], function($matches) use ($replace_callback, $i) {
            return eval('return '.$replace_callback[$i].';');
        }, $text);
    }
    $return = ($hook = get_hook('ps_do_bbcode_end')) ? eval($hook) : null;
    if ($return !== null)
        return $return;

    return $text;
}

Re: Error Log

You are showing me the code from the parser.php file. I told you to look into the code of the extension that adds code to the 'ps_do_bbcode_start' hook. Did you find any connected extensions with the 'ps_do_bbcode_start' hook? There can be more than one of them.

ForkBB
I speak only Russian  :P

Re: Error Log

Visman wrote:

You are showing me the code from the parser.php file. I told you to look into the code of the extension that adds code to the 'ps_do_bbcode_start' hook. Did you find any connected extensions with the 'ps_do_bbcode_start' hook? There can be more than one of them.

I searched the manifest file for every extension and did not find one instance (hook) of:

ps_do_bbcode_start

I did a ctrl find of every manifest file.

Any other place for me to look for this?

Was the manifest files the proper place to look?

Re: Error Log

I think I found it

https://i.postimg.cc/3x6pbK2w/Picture0052.png

Re: Error Log

Well, the hotfix_14_xss_bbcode_email extension is to blame.

ForkBB
I speak only Russian  :P

8 (edited by KamWest 2021-04-14 11:09)

Re: Error Log

Any idea how to fix it?

I also notice this button causes an error on submit (also causes an error on punbb.informer.com)

https://i.postimg.cc/59Ftrp7f/Picture0053.png

Re: Error Log

>Any idea how to fix it?
The options are:
1. Remove this extension and disable checking for updates and fixes in the admin panel of your forum.
2. Find the author of this extension and ask to fix it.

>I also notice this button causes an error on submit (also causes an error on punbb.informer.com)
Everything works fine in my punbb version.
punbb 1.4.5/1.4.6 and panbb 1.4.5 I do not support. Please contact the authors.

ForkBB
I speak only Russian  :P

10 (edited by KamWest 2021-04-14 17:49)

Re: Error Log

https://i.postimg.cc/QCJmRCr5/Picture0056.png


When I use the button on this forum, I get this error.

Re: Error Log

All these errors went away when I changed my PHP version from 7.2 to 7.0

Looks like that is causing the button issue as well

So for now I am going to run on php 7.0 until there is a wider fix.

12

Re: Error Log

>I also notice this button causes an error on submit (also causes an error on punbb.informer.com)
Everything works fine in my punbb version.
punbb 1.4.5/1.4.6 and panbb 1.4.5 I do not support. Please contact the authors.

+
https://punbb.informer.com/forums/topic … 72-and-74/
https://punbb.informer.com/forums/topic … by-visman/

ForkBB
I speak only Russian  :P

13 (edited by KamWest 2021-04-14 19:08)

Re: Error Log


Thank you, that explains everything

I thought I screwed up some of my modifications when these errors came to be but my webhost simply upgraded to php 7.2 causing me all these headaches.

When I get time I am going to install the visman version but first I will run it on a separate test board so I can take my time re-installing all my modifications.

@visman - you are a great help, we appreciate having you !!!