Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

class\xml\rpc\xmlrpctag problem with encode #419

Open
alain91 opened this issue Oct 11, 2015 · 1 comment
Open

class\xml\rpc\xmlrpctag problem with encode #419

alain91 opened this issue Oct 11, 2015 · 1 comment

Comments

@alain91
Copy link
Contributor

alain91 commented Oct 11, 2015

if we give string like '&' as input the encode method returns '&' and not #||amp||#

it seems that the replace is treated twice.

What does this method as to be clarified as it is only a one way of replacing.

    public function encode(&$text)
    {
        $text = preg_replace(array("/\&([a-z\d\#]+)\;/i", "/\&/", "/\#\|\|([a-z\d\#]+)\|\|\#/i"),
            array("#||\\1||#", "&amp;", "&\\1;"), str_replace(array("<", ">"), array("&lt;", "&gt;"), $text));
        return $text;
    }
geekwright added a commit to geekwright/XoopsCore that referenced this issue Oct 11, 2015
Replace old and likely faulty (XOOPS#419) regex based escape of XML unsafe or illegal characters with more recent PHP built in.
@geekwright
Copy link
Contributor

The xmlrpc code shows its age in lots of ways, and this function is one of them. A replacement is in the pipeline. The unit test needs to be reviewed, as the whole function was replaced with a standards based PHP internal function. It looks possibly like some double encoding work around was used, but it doesn't seem to be standard, so it was ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants