Make WordPress Core

Ticket #25280: 25280.2.patch

File 25280.2.patch, 737 bytes (added by c3mdigital, 11 years ago)

Don't run booleans through html_entity_decode() cast as a string

  • wp-includes/class.wp-scripts.php

     
    142142                }
    143143
    144144                foreach ( (array) $l10n as $key => $value ) {
    145                         if ( !is_scalar($value) )
     145                        if ( is_bool( $value ) || ! is_scalar( $value ) )
    146146                                continue;
    147147
    148148                        $l10n[$key] = html_entity_decode( (string) $value, ENT_QUOTES, 'UTF-8');
    149149                }
    150150
    151                 $script = "var $object_name = " . json_encode($l10n) . ';';
     151                $script = "var $object_name = " . defined( 'JSON_NUMERIC_CHECK' ) ? json_encode( $l10n, JSON_NUMERIC_CHECK ) : json_encode( $l10n ) . ';';
    152152
    153153                if ( !empty($after) )
    154154                        $script .= "\n$after;";