<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[46206] trunk: Code Modernization: Remove JSON extension workarounds for PHP < 5.6.</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="https://core.trac.wordpress.org/changeset/46206">46206</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"https://core.trac.wordpress.org/changeset/46206","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>desrosj</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2019-09-20 20:07:28 +0000 (Fri, 20 Sep 2019)</dd>
</dl>

<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>Code Modernization: Remove JSON extension workarounds for PHP < 5.6.

The PHP native JSON extension has been bundled and compiled with PHP by default since version 5.2.0. Because the minimum version of PHP required by WordPress is now 5.6.20 (see <a href="https://core.trac.wordpress.org/ticket/46594">#46594</a> and <a href="https://core.trac.wordpress.org/changeset/45058">[45058]</a>), JSON extension related polyfills and backwards compatibility code can now be removed.

This change removes code that supported JSON related functionality on older versions of PHP. This includes (but is not limited to) checks that `json_last_error()` exists, checking and setting the `JSON_UNESCAPED_SLASHES` and `JSON_PRETTY_PRINT` constants if not previously defined, and deprecating the `_wp_json_prepare_data()` function (which was 100% workaround code).

Follow up of <a href="https://core.trac.wordpress.org/changeset/46205">[46205]</a>.

See <a href="https://core.trac.wordpress.org/ticket/47699">#47699</a>.
Props jrf, Clorith, pento.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunksrcwpadminincludesnoopphp">trunk/src/wp-admin/includes/noop.php</a></li>
<li><a href="#trunksrcwpincludesclasswpcustomizemanagerphp">trunk/src/wp-includes/class-wp-customize-manager.php</a></li>
<li><a href="#trunksrcwpincludesfunctionsphp">trunk/src/wp-includes/functions.php</a></li>
<li><a href="#trunksrcwpincludesrestapiclasswprestrequestphp">trunk/src/wp-includes/rest-api/class-wp-rest-request.php</a></li>
<li><a href="#trunksrcwpincludesrestapiclasswprestserverphp">trunk/src/wp-includes/rest-api/class-wp-rest-server.php</a></li>
<li><a href="#trunktestsphpunittestscustomizemanagerphp">trunk/tests/phpunit/tests/customize/manager.php</a></li>
<li><a href="#trunktestsphpunittestsrestapirestschemasetupphp">trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunksrcwpadminincludesnoopphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-admin/includes/noop.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-admin/includes/noop.php      2019-09-20 19:52:38 UTC (rev 46205)
+++ trunk/src/wp-admin/includes/noop.php        2019-09-20 20:07:28 UTC (rev 46206)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -93,13 +93,6 @@
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_guess_url() {}
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-if ( ! function_exists( 'json_encode' ) ) :
-       /**
-        * @ignore
-        */
-       function json_encode() {}
-endif;
-
</del><span class="cx" style="display: block; padding: 0 10px"> function get_file( $path ) {
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        if ( function_exists( 'realpath' ) ) {
</span></span></pre></div>
<a id="trunksrcwpincludesclasswpcustomizemanagerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/class-wp-customize-manager.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/class-wp-customize-manager.php      2019-09-20 19:52:38 UTC (rev 46205)
+++ trunk/src/wp-includes/class-wp-customize-manager.php        2019-09-20 20:07:28 UTC (rev 46206)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1116,8 +1116,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        return new WP_Error( 'wrong_post_type' );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px">                $changeset_data = json_decode( $changeset_post->post_content, true );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( function_exists( 'json_last_error' ) && json_last_error() ) {
-                       return new WP_Error( 'json_parse_error', '', json_last_error() );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $last_error     = json_last_error();
+               if ( $last_error ) {
+                       return new WP_Error( 'json_parse_error', '', $last_error );
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px">                if ( ! is_array( $changeset_data ) ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        return new WP_Error( 'expected_array' );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -2843,13 +2844,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Gather the data for wp_insert_post()/wp_update_post().
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $json_options = 0;
-               if ( defined( 'JSON_UNESCAPED_SLASHES' ) ) {
-                       $json_options |= JSON_UNESCAPED_SLASHES; // Introduced in PHP 5.4. This is only to improve readability as slashes needn't be escaped in storage.
-               }
-               $json_options |= JSON_PRETTY_PRINT; // Also introduced in PHP 5.4, but WP defines constant for back compat. See WP Trac #30139.
-               $post_array    = array(
-                       'post_content' => wp_json_encode( $data, $json_options ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $post_array = array(
+                       // JSON_UNESCAPED_SLASHES is only to improve readability as slashes needn't be escaped in storage.
+                       'post_content' => wp_json_encode( $data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT ),
</ins><span class="cx" style="display: block; padding: 0 10px">                 );
</span><span class="cx" style="display: block; padding: 0 10px">                if ( $args['title'] ) {
</span><span class="cx" style="display: block; padding: 0 10px">                        $post_array['post_title'] = $args['title'];
</span></span></pre></div>
<a id="trunksrcwpincludesfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/functions.php       2019-09-20 19:52:38 UTC (rev 46205)
+++ trunk/src/wp-includes/functions.php 2019-09-20 20:07:28 UTC (rev 46206)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3721,6 +3721,7 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * Encode a variable into JSON, with some sanity checks.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @since 4.1.0
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since 5.3.0 No longer handles support for PHP < 5.6.
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param mixed $data    Variable (usually an array or object) to encode as JSON.
</span><span class="cx" style="display: block; padding: 0 10px">  * @param int   $options Optional. Options to be passed to json_encode(). Default 0.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3729,39 +3730,20 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * @return string|false The JSON encoded string, or false if it cannot be encoded.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function wp_json_encode( $data, $options = 0, $depth = 512 ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        /*
-        * json_encode() has had extra params added over the years.
-        * $options was added in 5.3, and $depth in 5.5.
-        * We need to make sure we call it with the correct arguments.
-        */
-       if ( version_compare( PHP_VERSION, '5.5', '>=' ) ) {
-               $args = array( $data, $options, $depth );
-       } elseif ( version_compare( PHP_VERSION, '5.3', '>=' ) ) {
-               $args = array( $data, $options );
-       } else {
-               $args = array( $data );
-       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $json = json_encode( $data, $options, $depth );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // Prepare the data for JSON serialization.
-       $args[0] = _wp_json_prepare_data( $data );
-
-       // phpcs:ignore WordPress.PHP.NoSilencedErrors.Discouraged -- json_encode() errors are handled after this call
-       $json = @call_user_func_array( 'json_encode', $args );
-
</del><span class="cx" style="display: block; padding: 0 10px">         // If json_encode() was successful, no need to do more sanity checking.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        // ... unless we're in an old version of PHP, and json_encode() returned
-       // a string containing 'null'. Then we need to do more sanity checking.
-       if ( false !== $json && ( version_compare( PHP_VERSION, '5.5', '>=' ) || false === strpos( $json, 'null' ) ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ if ( false !== $json ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                 return $json;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">        try {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                $args[0] = _wp_json_sanity_check( $data, $depth );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $data = _wp_json_sanity_check( $data, $depth );
</ins><span class="cx" style="display: block; padding: 0 10px">         } catch ( Exception $e ) {
</span><span class="cx" style="display: block; padding: 0 10px">                return false;
</span><span class="cx" style="display: block; padding: 0 10px">        }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        return call_user_func_array( 'json_encode', $args );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ return json_encode( $data, $options, $depth );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3865,48 +3847,17 @@
</span><span class="cx" style="display: block; padding: 0 10px">  * This supports the JsonSerializable interface for PHP 5.2-5.3 as well.
</span><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @ignore
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @since 4.4.0
- * @access private
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @since      4.4.0
+ * @deprecated 5.3.0 This function is no longer needed as support for PHP 5.2-5.3
+ *                   has been dropped.
+ * @access     private
</ins><span class="cx" style="display: block; padding: 0 10px">  *
</span><span class="cx" style="display: block; padding: 0 10px">  * @param mixed $data Native representation.
</span><span class="cx" style="display: block; padding: 0 10px">  * @return bool|int|float|null|string|array Data ready for `json_encode()`.
</span><span class="cx" style="display: block; padding: 0 10px">  */
</span><span class="cx" style="display: block; padding: 0 10px"> function _wp_json_prepare_data( $data ) {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-        if ( ! defined( 'WP_JSON_SERIALIZE_COMPATIBLE' ) || WP_JSON_SERIALIZE_COMPATIBLE === false ) {
-               return $data;
-       }
-
-       switch ( gettype( $data ) ) {
-               case 'boolean':
-               case 'integer':
-               case 'double':
-               case 'string':
-               case 'NULL':
-                       // These values can be passed through.
-                       return $data;
-
-               case 'array':
-                       // Arrays must be mapped in case they also return objects.
-                       return array_map( '_wp_json_prepare_data', $data );
-
-               case 'object':
-                       // If this is an incomplete object (__PHP_Incomplete_Class), bail.
-                       if ( ! is_object( $data ) ) {
-                               return null;
-                       }
-
-                       if ( $data instanceof JsonSerializable ) {
-                               $data = $data->jsonSerialize();
-                       } else {
-                               $data = get_object_vars( $data );
-                       }
-
-                       // Now, pass the array (or whatever was returned from jsonSerialize through).
-                       return _wp_json_prepare_data( $data );
-
-               default:
-                       return null;
-       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ _deprecated_function( __FUNCTION__, '5.3.0' );
+       return $data;
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px"> /**
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiclasswprestrequestphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/class-wp-rest-request.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/class-wp-rest-request.php  2019-09-20 19:52:38 UTC (rev 46205)
+++ trunk/src/wp-includes/rest-api/class-wp-rest-request.php    2019-09-20 20:07:28 UTC (rev 46206)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -639,21 +639,16 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                /*
</span><span class="cx" style="display: block; padding: 0 10px">                 * Check for a parsing error.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                 *
-                * Note that due to WP's JSON compatibility functions, json_last_error
-                * might not be defined: https://core.trac.wordpress.org/ticket/27799
</del><span class="cx" style="display: block; padding: 0 10px">                  */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( null === $params && ( ! function_exists( 'json_last_error' ) || JSON_ERROR_NONE !== json_last_error() ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( null === $params && JSON_ERROR_NONE !== json_last_error() ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         // Ensure subsequent calls receive error instance.
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->parsed_json = false;
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        $error_data = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                                'status' => WP_Http::BAD_REQUEST,
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                         'status'             => WP_Http::BAD_REQUEST,
+                               'json_error_code'    => json_last_error(),
+                               'json_error_message' => json_last_error_msg(),
</ins><span class="cx" style="display: block; padding: 0 10px">                         );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( function_exists( 'json_last_error' ) ) {
-                               $error_data['json_error_code']    = json_last_error();
-                               $error_data['json_error_message'] = json_last_error_msg();
-                       }
</del><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                        return new WP_Error( 'rest_invalid_json', __( 'Invalid JSON body passed.' ), $error_data );
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span></span></pre></div>
<a id="trunksrcwpincludesrestapiclasswprestserverphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/src/wp-includes/rest-api/class-wp-rest-server.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/src/wp-includes/rest-api/class-wp-rest-server.php   2019-09-20 19:52:38 UTC (rev 46205)
+++ trunk/src/wp-includes/rest-api/class-wp-rest-server.php     2019-09-20 20:07:28 UTC (rev 46206)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1001,14 +1001,9 @@
</span><span class="cx" style="display: block; padding: 0 10px">         * @return bool|string Boolean false or string error message.
</span><span class="cx" style="display: block; padding: 0 10px">         */
</span><span class="cx" style="display: block; padding: 0 10px">        protected function get_json_last_error() {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                // See https://core.trac.wordpress.org/ticket/27799.
-               if ( ! function_exists( 'json_last_error' ) ) {
-                       return false;
-               }
-
</del><span class="cx" style="display: block; padding: 0 10px">                 $last_error_code = json_last_error();
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( ( defined( 'JSON_ERROR_NONE' ) && JSON_ERROR_NONE === $last_error_code ) || empty( $last_error_code ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( JSON_ERROR_NONE === $last_error_code || empty( $last_error_code ) ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         return false;
</span><span class="cx" style="display: block; padding: 0 10px">                }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span></span></pre></div>
<a id="trunktestsphpunittestscustomizemanagerphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/customize/manager.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/customize/manager.php   2019-09-20 19:52:38 UTC (rev 46205)
+++ trunk/tests/phpunit/tests/customize/manager.php     2019-09-20 20:07:28 UTC (rev 46206)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1856,9 +1856,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                $r = $manager->save_changeset_post( $args );
</span><span class="cx" style="display: block; padding: 0 10px">                $this->assertInstanceOf( 'WP_Error', $r );
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( function_exists( 'json_last_error' ) ) {
-                       $this->assertEquals( 'json_parse_error', $r->get_error_code() );
-               }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         $this->assertEquals( 'json_parse_error', $r->get_error_code() );
</ins><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                wp_update_post(
</span><span class="cx" style="display: block; padding: 0 10px">                        array(
</span></span></pre></div>
<a id="trunktestsphpunittestsrestapirestschemasetupphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php  2019-09-20 19:52:38 UTC (rev 46205)
+++ trunk/tests/phpunit/tests/rest-api/rest-schema-setup.php    2019-09-20 20:07:28 UTC (rev 46206)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -488,16 +488,14 @@
</span><span class="cx" style="display: block; padding: 0 10px">                        );
</span><span class="cx" style="display: block; padding: 0 10px">                        $this->assertTrue( ! empty( $data ), $route['name'] . ' route should return data.' );
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                        if ( version_compare( PHP_VERSION, '5.4', '>=' ) ) {
-                               $fixture           = $this->normalize_fixture( $data, $route['name'] );
-                               $mocked_responses .= "\nmockedApiResponse." . $route['name'] . ' = '
-                                       . json_encode( $fixture, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES )
-                                       . ";\n";
-                       }
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+                 $fixture           = $this->normalize_fixture( $data, $route['name'] );
+                       $mocked_responses .= "\nmockedApiResponse." . $route['name'] . ' = '
+                               . json_encode( $fixture, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES )
+                               . ";\n";
</ins><span class="cx" style="display: block; padding: 0 10px">                 }
</span><span class="cx" style="display: block; padding: 0 10px"> 
</span><span class="cx" style="display: block; padding: 0 10px">                // Only generate API client fixtures in single site and when required JSON_* constants are supported.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-                if ( ! is_multisite() && version_compare( PHP_VERSION, '5.4', '>=' ) ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+         if ( ! is_multisite() ) {
</ins><span class="cx" style="display: block; padding: 0 10px">                         // Save the route object for QUnit tests.
</span><span class="cx" style="display: block; padding: 0 10px">                        $file = dirname( DIR_TESTROOT ) . '/qunit/fixtures/wp-api-generated.js';
</span><span class="cx" style="display: block; padding: 0 10px">                        file_put_contents( $file, $mocked_responses );
</span></span></pre>
</div>
</div>

</body>
</html>