WordPress.org

Make WordPress Core

Ticket #36358: 36358-patch3-_wp_json_prepare_data.patch

File 36358-patch3-_wp_json_prepare_data.patch, 1.1 KB (added by jrf, 6 years ago)
  • src/wp-includes/functions.php

    From 3d1575a001835e301f558537a6835a77d55b31ad Mon Sep 17 00:00:00 2001
    From: jrfnl <github_nospam@adviesenzo.nl>
    Date: Mon, 28 Mar 2016 18:35:14 +0200
    Subject: [PATCH] Fix _wp_json_prepare_data() called unnecessarily early.
    
    ---
     src/wp-includes/functions.php | 5 ++---
     1 file changed, 2 insertions(+), 3 deletions(-)
    
    diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
    index 0e720ee..b47cce4 100644
    a b function wp_json_encode( $data, $options = 0, $depth = 512 ) { 
    28612861                $args = array( $data );
    28622862        }
    28632863
    2864         // Prepare the data for JSON serialization.
    2865         $data = _wp_json_prepare_data( $data );
    2866 
    28672864        $json = @call_user_func_array( 'json_encode', $args );
    28682865
    28692866        // If json_encode() was successful, no need to do more sanity checking.
    function wp_json_encode( $data, $options = 0, $depth = 512 ) { 
    28742871        }
    28752872
    28762873        try {
     2874                // Prepare the data for JSON serialization.
     2875                $data    = _wp_json_prepare_data( $data );
    28772876                $args[0] = _wp_json_sanity_check( $data, $depth );
    28782877        } catch ( Exception $e ) {
    28792878                return false;