0

Actually, I searched over here to get the answer but I couldn't find it. This is happening when I switch to php 7.4.

            if ($signature != '') {
                if ( !$board_config['allow_html'] || !$userinfo['user_allowhtml']) {
                    $signature = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $signature);
                }

Well actually this is happpening when i switch to php 7.4 only.

        if ($ya_config['usesignature'] >= '1') {
        // Start - Added to allow bbcode & smilies to be displayed - RN v2.40.00
        $signature = $usrinfo['user_sig'];
        $resultbc = $db->sql_query('SELECT * FROM ' . $prefix . '_bbconfig WHERE config_name = "allow_html" OR config_name = "allow_bbcode" OR config_name = "allow_smilies" OR config_name = "smilies_path"');
        while ($rowbc = $db->sql_fetchrow($resultbc)) {
            $board_config[$rowbc['config_name']] = $rowbc['config_value'];
        }

        define('IN_PHPBB', TRUE);
        include_once('./modules/Forums/includes/constants.php');
        include_once('./modules/Forums/includes/bbcode.php');
        include_once('./modules/' . $module_name . '/includes/phpbb_bbstuff.php');

        if ($signature != '') {
            if ( !$board_config['allow_html'] || !$userinfo['user_allowhtml']) {
                $signature = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $signature);
            }

            if ($usrinfo['user_sig_bbcode_uid'] != '') {
                $signature = ($board_config['allow_bbcode'] && isset($userinfo['user_allowbbcode'])) ? parse_bbcode($signature, $usrinfo['user_sig_bbcode_uid']) : preg_replace("/\:".$usrinfo['user_sig_bbcode_uid']."/si", '', $signature);
            }

            $signature = make_clickable($signature);

            if ($board_config['allow_smilies']) {
                if (isset($userinfo['user_allowsmile'])) {
                    $signature = smilies_pass($signature);
                }
            }

            $signature = str_replace("\n", "\n<br />\n", $signature);
        }
        // End

I already fixed it myself. Thanks anyway

if ($signature != '') {
               if ( !$board_config['allow_html'] || (isset($userinfo['user_allowhtml']) && !$userinfo['user_allowhtml'])) {
  $signature = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $signature);
}
  • Trying to access array offset on value of type null in – Bestbuildpc Net Mar 06 '23 at 22:22
  • Please edit the question to include the errors. If the array keys might not exist you can test that with `array_key_exists` - https://www.php.net/manual/en/function.array-key-exists.php To check if the arrays exist at all use `isset` Also see https://stackoverflow.com/help/how-to-ask and https://stackoverflow.com/help/minimal-reproducible-example – Dave S Mar 06 '23 at 22:28
  • the error is coming from this line:if ( !$board_config['allow_html'] || !$userinfo['user_allowhtml']) { – Bestbuildpc Net Mar 06 '23 at 22:45
  • Please edit the question to include the exact error message. I'm guessing it is your first comment, but we shouldn't have to guess. – Dave S Mar 06 '23 at 22:58
  • Also, have you done anything to debug this, for example by adding `echo` and `var_dump` to see the values of all of the variables that you are using? – Dave S Mar 06 '23 at 23:02
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Mar 07 '23 at 04:45

1 Answers1

0
if ( !$board_config['allow_html'] || (isset($userinfo['user_allowhtml']) && !$userinfo['user_allowhtml'])) {
  $signature = preg_replace('#(<)([\/]?.*?)(>)#is', "&lt;\\2&gt;", $signature);
}

using isset fixed the error