1 (edited by adam111 2023-07-05 15:08)

Topic: Tag list doesn't work

Please help me solve the problem, list tag does not work, php gives the following error.

Fatal error: Uncaught ArgumentCountError: Too few arguments to function {closure}(), 1 passed and exactly 2 expected in /var/www/html/include/parser.php:58 Stack trace: #0 [internal function]: {closure}(Array) #1 /var/www/html/include/parser.php(60): preg_replace_callback('%\\[list(?:=([1a...', Object(Closure), '\xD0\x9D\xD1\x83 \xD1\x87\xD1\x82\xD0\xBE \xD0\xB6\xD0...') #2 /var/www/html/post.php(179): preparse_bbcode('\xD0\x9D\xD1\x83 \xD1\x87\xD1\x82\xD0\xBE \xD0\xB6\xD0...', Array) #3 {main} thrown in /var/www/html/include/parser.php on line 58

Re: Tag list doesn't work

show lines 50 to 70 from file /include/parser.php

ForkBB
I speak only Russian  :P

Re: Tag list doesn't work

Visman wrote:

show lines 50 to 70 from file /include/parser.php

                if (strpos($text, '[ code ]') !== false && strpos($text, '[ /code ]') !== false)
                {
                        list($inside, $outside) = split_text($text, '[ code ]', '[ /code ]', $errors);
                        $text = implode("\x1", $outside);
                }

                // Tidy up lists
                $pattern_callback = '%\[list(?:=([1a*]))?+\]((?:(?>.*?(?=\[list(?:=[1a*])?+\]|\[/list\]))|(?R))*)\[/list\]%is';
                $text = preg_replace_callback($pattern_callback, function($matches, $errors) {
                    return preparse_list_tag($matches[2], $matches[1], $errors);
        }, $text);
                $text = str_replace('*'."\0".']', '*]', $text);

                if ($forum_config['o_make_links'] == '1')
                {
                        $text = do_clickable($text, defined('FORUM_SUPPORT_PCRE_UNICODE'));
                }

                // If we split up the message before we have to concatenate it together again (code tags)
                if (isset($inside))
                {

Re: Tag list doesn't work

You can try to replace

 
        $text = preg_replace_callback($pattern_callback, function($matches, $errors) {
            return preparse_list_tag($matches[2], $matches[1], $errors);
        }, $text);

to

        $text = preg_replace_callback($pattern_callback, function ($matches) use (&$errors) {
            return preparse_list_tag($matches[2], $matches[1], $errors);
        }, $text);
ForkBB
I speak only Russian  :P