-
Notifications
You must be signed in to change notification settings - Fork 125
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
Quotes shouldn't be escaped #220
Comments
Thanks @tacoverdo!
Have you checked the database entry? It should be escaped there which is wrong. |
should prevent the extra slashes. This requires some more testing/investigation as it probably affects all POST actions. |
Agreed, BackPress probably didn't enable magic quotes and WordPress does so we'll have to check any time we get post/get data. |
From https://glotpress.trac.wordpress.org/browser/trunk/gp-settings.php#L76 // alleviate the magic_quotes_gpc effects
if ( get_magic_quotes_gpc() ) {
$_GET = stripslashes_deep( $_GET );
$_POST = stripslashes_deep( $_POST );
$_COOKIE = stripslashes_deep( $_COOKIE );
} |
/**
* Add magic quotes to `$_GET`, `$_POST`, `$_COOKIE`, and `$_SERVER`.
*
* Also forces `$_REQUEST` to be `$_GET + $_POST`. If `$_SERVER`,
* `$_COOKIE`, or `$_ENV` are needed, use those superglobals directly.
*
* @since 3.0.0
* @access private
*/
function wp_magic_quotes() {
// If already slashed, strip.
if ( get_magic_quotes_gpc() ) {
$_GET = stripslashes_deep( $_GET );
$_POST = stripslashes_deep( $_POST );
$_COOKIE = stripslashes_deep( $_COOKIE );
}
// Escape with wpdb.
$_GET = add_magic_quotes( $_GET );
$_POST = add_magic_quotes( $_POST );
$_COOKIE = add_magic_quotes( $_COOKIE );
$_SERVER = add_magic_quotes( $_SERVER );
// Force REQUEST to be GET + POST.
$_REQUEST = array_merge( $_GET, $_POST );
} 😢 |
Yea, I remember taking those out as we didn't want to mess with the global. Fortunately it looks like it should be an easy fix as |
...and in |
Yeah, that should work. Although some functions are accessing the superglobals directly, like |
Those should be relatively few and far between, scrubbing the code for them should be easy enough. |
Problem description
When adding a translation that contains quotes, or when filtering on something containing a quote, the quote is automagically escaped. This can lead to problems in the translated languages.
Example
![translations___dutch___yoast_seo__for_wordpress____glotpress](https://cloud.githubusercontent.com/assets/5147598/12453840/50f4de22-bf95-11e5-804d-860c9fab94bf.png)
The entered translation is
Het focus-zoekwoord '%1$s' komt niet voor in de pagina titel.
. It's added as expected. However, when going back to the string, or when looking at the waiting strings, it shows asHet focus-zoekwoord \'%1$s\' komt niet voor in de pagina titel.
.(link to live example)
That's annoying, but in this string, things are getting problematic:
Het redirect-type is de HTTP respons code die naar de browser wordt gezonden om aan te geven welk type redirect er wordt uitgeserveerd. <br/><br/>Lees <a href=\'%s\' target=\'_blank\'>deze pagina</a> voor meer informatie.
means the HTML is affected and thus causes invalid HTML output.Possible fix
Do not escape every input.
Tested versions
WordPress 4.4.1
GlotPress plugin 1.0
The text was updated successfully, but these errors were encountered: