Making WordPress.org

Changeset 3716


Ignore:
Timestamp:
07/24/2016 10:19:12 AM (9 years ago)
Author:
ocean90
Message:

Plugin Directory: Don't use the translation in the replacement parameter of preg_replace().

The translation may contain backreference-like characters.

Fixes #1619.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-plugin-i18n.php

    r3543 r3716  
    415415        } else {
    416416            $original = preg_quote( $original, '/' );
    417             $content  = preg_replace( "/(<([a-z0-9]*)\b[^>]*>){$original}(<\/\\2>)/m", "\\1{$translation}\\3", $content );
    418         }
     417            $content  = preg_replace( "/(<([a-z0-9]*)\b[^>]*>){$original}(<\/\\2>)/m", '${1}___TRANSLATION___${3}', $content ); // Don't use $translation, it may contain backreference-like characters.
     418            $content  = str_replace( '___TRANSLATION___', $translation, $content );     }
    419419
    420420        return $content;
Note: See TracChangeset for help on using the changeset viewer.