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

Repeatable unescaping of html content leads to not valid html #5

Open
Joyfolk opened this issue Jun 21, 2020 · 0 comments
Open

Repeatable unescaping of html content leads to not valid html #5

Joyfolk opened this issue Jun 21, 2020 · 0 comments

Comments

@Joyfolk
Copy link

Joyfolk commented Jun 21, 2020

$data = html_entity_decode($data);

This line leads to invalid HTML for some documents (for example for /edsapi/rest/Retrieve?an=T115986&dbid=dmp) because of double decoding of HTML content (&amp;lt; becomes < inside HTML body).

Looks like there is no reason to decode HTML content here - it is already decoded inside SimpleXML object. The only thing left to decode is the content of the <ephtml> tags which is double encoded.
So, this line should probably be something like this:

$data = preg_replace_callback('/<ephtml>(.*?)<\/ephtml>/m', function($escaped) {
            return html_entity_decode($escaped[0]);
}, $data);
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

1 participant