Make WordPress Core

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

File 47783-magic_quotes_deprecation-wp-core--2.patch, 2.3 KB (added by ayeshrajans, 6 years ago)

Replaces 47783-magic_quotes_deprecation-wp-core.patch. PHPDoc for map_deep() function is updated to reflect the changes.

  • src/wp-includes/formatting.php

    diff --git a/src/wp-includes/formatting.php b/src/wp-includes/formatting.php
    index 1a8d7b6507..880fea8d0a 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 ) { 
    47694765/**
    47704766 * Parses a string into variables to be stored in an array.
    47714767 *
    4772  * Uses {@link https://secure.php.net/parse_str parse_str()} and stripslashes if
    4773  * {@link https://secure.php.net/magic_quotes magic_quotes_gpc} is on.
    47744768 *
    47754769 * @since 2.2.1
    47764770 *
    function map_deep( $value, $callback ) { 
    47794773 */
    47804774function wp_parse_str( $string, &$array ) {
    47814775        parse_str( $string, $array );
    4782         if ( get_magic_quotes_gpc() ) {
    4783                 $array = stripslashes_deep( $array );
    4784         }
     4776
    47854777        /**
    47864778         * Filters the array of variables derived from a parsed string.
    47874779         *
  • 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.