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

Ensure HTML special characters don't get double-encoded #182

Closed
wants to merge 1 commit into from

Conversation

coreymckrill
Copy link

I believe this will address the issues described in #108 and #159. At first I thought I would just add

$code = str_replace( '>', '>', $code );

...as a third line under "Undo escaping...", but then I figured it would potentially catch more edge cases to just decode all HTML entities at this point in the code. Entities get re-encoded later in the shortcode_callback method, so this helps further prevent double-encoding.

…e encoded and output by the render callback

I believe this will address the issues described in #108 and #159. At first I thought I would just add `$code = str_replace( '>', '>', $code );` as a third line of "Undo escaping...", but then I figured it would potentially catch more edge cases to just decode all HTML entities at this point in the code. They get re-encoded later in the `shortcode_callback` method, so this helps further prevent double-encoding.
coreymckrill added a commit to WordPress/Learn that referenced this pull request Dec 4, 2020
…#162)

In some cases the `>` is getting double encoded. In lesson plans, for example, this is causing all code snippets to have `>` instead of `>`. This simply undoes the double-encoding. Ideally this can get fixed upstream.

See Automattic/syntaxhighlighter#182

Fixes #158
@hbgl
Copy link

hbgl commented Jan 10, 2021

I think you should also add a htmlspecialchars at line 1166.

Hope this gets merged.

@yscik
Copy link
Contributor

yscik commented Jan 26, 2021

Thanks for the PR! Resolved the conflicts and included this in #187, should be out in the next release.

@yscik yscik closed this Jan 26, 2021
@thedebian thedebian deleted the coreymckrill-patch-1 branch November 22, 2023 14:41
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

Successfully merging this pull request may close these issues.

None yet

3 participants