0

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;
}

Edited by sheik_2

2
Contributors
3
Replies
22
Views
3 Weeks
Discussion Span
Last Post by rproffitt
0

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

0

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.

Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.