WordPress.org

Make WordPress Core

Ticket #48605: 48605-fix-add-magic-quotes.patch

File 48605-fix-add-magic-quotes.patch, 854 bytes (added by jrf, 10 months ago)

Fix add_magic_quotes() Magic quotes are only relevant for string values. Anything non-string should be left untouched.

  • src/wp-includes/functions.php

    From f23b86d517e7812a34d4f51f7475af574bcbf8cb Mon Sep 17 00:00:00 2001
    From: jrfnl <jrfnl@users.noreply.github.com>
    Date: Fri, 22 Nov 2019 01:05:01 +0100
    Subject: [PATCH] Fix add_magic_quotes()
    
    Magic quotes are only relevant for string values. Anything non-string should be left untouched.
    ---
     src/wp-includes/functions.php | 4 ++++
     1 file changed, 4 insertions(+)
    
    diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
    index 3ac199e1f0..fe12e9177b 100644
    a b function wp_removable_query_args() { 
    11961196 */
    11971197function add_magic_quotes( $array ) {
    11981198        foreach ( (array) $array as $k => $v ) {
     1199                if ( ! is_string( $v ) ) {
     1200                        continue;
     1201                }
     1202
    11991203                if ( is_array( $v ) ) {
    12001204                        $array[ $k ] = add_magic_quotes( $v );
    12011205                } else {