Hi,

Below is my code can you please help me to fix it.

function gw_bbcode_html($t)
{
    $regexfind[] = '/\<(.+)\>/esiU';
    $t = str_replace('&', '&', $t);
    $t = str_replace('"', '"', $t);
    $t = str_replace('&039;', '\'', $t);
    $regexreplace[] = "gw_bbcode_html_tag(gw_bbcode_htmlspecialchars('\\1'))";
    $t = preg_replace_callback($regexfind, $regexreplace, $t);
#   $t = str_replace('&#', '&#', $t);
    $t = str_replace('![cdata', '![CDATA', $t);
    $t = str_replace('!doctype', '!DOCTYPE', $t);
    $t = str_replace("\t", '       ', $t);
    $t = str_replace("\n", '<br />', $t);
    $t = str_replace('  ', '&#160;&#160;', $t);
    return $t;
}

Hi I am using PHP Version 5.5.15 and the error is "preg_replace_callback(): Requires argument 2, 'Array', to be a valid"

Maybe you don't want to use a callback? I'm guessing here since the error message still looks truncated.
Read https://stackoverflow.com/questions/44602874/warning-preg-replace-callback-requires-argument-2-to-be-a-valid-callback where it's covered by a reply with "You cannot use a plain text string with variables in it, it needs to be a callable (function), please check the documentation for more information."

Since you know what your code was supposed to do, change to another function or change the variables to callable functions.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.