WordPress.org

Make WordPress Core

Ticket #11537: 11537.2.diff

File 11537.2.diff, 1.1 KB (added by nacin, 8 years ago)

Upgrades dependency and switches WP's compat json_encode to use encodeUnsafe, so no headers are sent, to match PHP functionality.

  • class-json.php

     
    5050 * @author              Matt Knapp <mdknapp[at]gmail[dot]com>
    5151 * @author              Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
    5252 * @copyright   2005 Michal Migurski
    53  * @version             CVS: $Id: JSON.php,v 1.3 2009/05/22 23:51:00 alan_k Exp $
     53 * @version     CVS: $Id: JSON.php 288200 2009-09-09 15:41:29Z alan_k $
    5454 * @license             http://www.opensource.org/licenses/bsd-license.php
    5555 * @link                http://pear.php.net/pepr/pepr-proposal-show.php?id=198
    5656 */
     
    235235        */
    236236        function encode($var)
    237237        {
    238                 header('Content-type: application/x-javascript');
     238                header('Content-type: application/json');
    239239                return $this->_encode($var);
    240240        }
    241241        /**
  • compat.php

     
    133133                        $wp_json = new Services_JSON();
    134134                }
    135135
    136                 return $wp_json->encode( $string );
     136                return $wp_json->encodeUnsafe( $string );
    137137        }
    138138}
    139139