Skip to content

PHP error: The /e modifier is deprecated, use preg_replace_callback instead  #35

Open
@njwgh

Description

Getting a php error on the xssclean.php file at lines 285 and 286
"The /e modifier is deprecated, use preg_replace_callback instead "

285:
$str = preg_replace('~&#x(0*[0-9a-f]{2,5})~ei', 'chr(hexdec("\1"))', $str);

suggest it is rewritten to:
$str = preg_replace_callback('~&#x(0*[0-9a-f]{2,5})~ei',
create_function ('$matches', 'return chr(hexdec($matches[1]));'), $str);

286:
return preg_replace('~&#([0-9]{2,4})~e', 'chr(\1)', $str);

suggest it is rewritten to:

return preg_replace_callback('~&#([0-9]{2,4})~e', 'chr(\1)',
create_function ('$matches', 'return chr($matches[1]);'), $str);

Can anyone confirm that this is correct?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions