From fced7be5798fc694796c1446c4316711184417b8 Mon Sep 17 00:00:00 2001
From: jrfnl <github_nospam@adviesenzo.nl>
Date: Mon, 28 Mar 2016 18:33:06 +0200
Subject: [PATCH] Fix _wp_json_prepare_data() was called too late.
---
src/wp-includes/functions.php | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php
index 0e720ee..6d8e3b6 100644
a
|
b
|
function _scalar_wp_die_handler( $message = '' ) { |
2848 | 2848 | * @return string|false The JSON encoded string, or false if it cannot be encoded. |
2849 | 2849 | */ |
2850 | 2850 | function wp_json_encode( $data, $options = 0, $depth = 512 ) { |
| 2851 | |
| 2852 | // Prepare the data for JSON serialization. |
| 2853 | $data = _wp_json_prepare_data( $data ); |
| 2854 | |
2851 | 2855 | /* |
2852 | 2856 | * json_encode() has had extra params added over the years. |
2853 | 2857 | * $options was added in 5.3, and $depth in 5.5. |
… |
… |
function wp_json_encode( $data, $options = 0, $depth = 512 ) { |
2861 | 2865 | $args = array( $data ); |
2862 | 2866 | } |
2863 | 2867 | |
2864 | | // Prepare the data for JSON serialization. |
2865 | | $data = _wp_json_prepare_data( $data ); |
2866 | | |
2867 | 2868 | $json = @call_user_func_array( 'json_encode', $args ); |
2868 | 2869 | |
2869 | 2870 | // If json_encode() was successful, no need to do more sanity checking. |