Make WordPress Core

Ticket #47783: 47783-magic_quotes_deprecation-wp-core.patch

File 47783-magic_quotes_deprecation-wp-core.patch, 2.0 KB (added by ayeshrajans, 6 years ago)
  • src/wp-includes/formatting.php

    diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
    index 1a8d7b6507..021f14ebbb 100644
    a b function untrailingslashit( $string ) { 
    26762676 * @return string Returns a string escaped with slashes.
    26772677 */
    26782678function addslashes_gpc( $gpc ) {
    2679         if ( get_magic_quotes_gpc() ) {
    2680                 $gpc = stripslashes( $gpc );
    2681         }
    2682 
    26832679        return wp_slash( $gpc );
    26842680}
    26852681
    function map_deep( $value, $callback ) { 
    47794775 */
    47804776function wp_parse_str( $string, &$array ) {
    47814777        parse_str( $string, $array );
    4782         if ( get_magic_quotes_gpc() ) {
    4783                 $array = stripslashes_deep( $array );
    4784         }
     4778
    47854779        /**
    47864780         * Filters the array of variables derived from a parsed string.
    47874781         *
  • src/wp-includes/load.php

    diff --git a/src/wp-includes/load.php b/src/wp-includes/load.php
    index 38b4b771b2..133c03d11e 100644
    a b function wp_set_internal_encoding() { 
    925925 * @access private
    926926 */
    927927function wp_magic_quotes() {
    928         // If already slashed, strip.
    929         if ( get_magic_quotes_gpc() ) {
    930                 $_GET    = stripslashes_deep( $_GET );
    931                 $_POST   = stripslashes_deep( $_POST );
    932                 $_COOKIE = stripslashes_deep( $_COOKIE );
    933         }
    934 
    935928        // Escape with wpdb.
    936929        $_GET    = add_magic_quotes( $_GET );
    937930        $_POST   = add_magic_quotes( $_POST );
  • src/wp-includes/rest-api/class-wp-rest-request.php

    diff --git a/src/wp-includes/rest-api/class-wp-rest-request.php b/src/wp-includes/rest-api/class-wp-rest-request.php
    index 3089547ce7..38bc0570a3 100644
    a b protected function parse_body_params() { 
    689689
    690690                parse_str( $this->get_body(), $params );
    691691
    692                 /*
    693                  * Amazingly, parse_str follows magic quote rules. Sigh.
    694                  *
    695                  * NOTE: Do not refactor to use `wp_unslash`.
    696                  */
    697                 if ( get_magic_quotes_gpc() ) {
    698                         $params = stripslashes_deep( $params );
    699                 }
    700 
    701692                /*
    702693                 * Add to the POST parameters stored internally. If a user has already
    703694                 * set these manually (via `set_body_params`), don't override them.