~ubuntu-branches/debian/jessie/wordpress/jessie

« back to all changes in this revision

Viewing changes to wp-includes/compat.php

  • Committer: Package Import Robot
  • Author(s): Craig Small
  • Date: 2014-08-07 18:26:39 UTC
  • mfrom: (1.2.37)
  • Revision ID: package-import@ubuntu.com-20140807182639-sr9h41nr2yud1de6
Tags: 3.9.2+dfsg-1
* New Upstream release
* Fixes XML Security bug Closes: #757312

Show diffs side-by-side

added added

removed removed

Lines of Context:
94
94
                return is_array($data) ? array_map(__FUNCTION__, $data) : $data;
95
95
        }
96
96
}
 
97
 
 
98
if ( ! function_exists( 'hash_equals' ) ) :
 
99
/**
 
100
 * Compare two strings in constant time.
 
101
 *
 
102
 * This function was added in PHP 5.6.
 
103
 * It can leak the length of a string.
 
104
 *
 
105
 * @since 3.9.2
 
106
 *
 
107
 * @param string $a Expected string.
 
108
 * @param string $b Actual string.
 
109
 * @return bool Whether strings are equal.
 
110
 */
 
111
function hash_equals( $a, $b ) {
 
112
        $a_length = strlen( $a );
 
113
        if ( $a_length !== strlen( $b ) ) {
 
114
                return false;
 
115
        }
 
116
        $result = 0;
 
117
 
 
118
        // Do not attempt to "optimize" this.
 
119
        for ( $i = 0; $i < $a_length; $i++ ) {
 
120
                $result |= ord( $a[ $i ] ) ^ ord( $b[ $i ] );
 
121
        }
 
122
 
 
123
        return $result === 0;
 
124
}
 
125
endif;
 
 
b'\\ No newline at end of file'