StringUtils deprecated

class StringUtils

deprecated

since 2.8, to be removed in 3.0.

String utility functions.

Methods

static bool equals(string $knownString, string $userInput)

Compares two strings.

static int safeStrlen(string $string)

Returns the number of bytes in a string.

Details

static bool equals(string $knownString, string $userInput)

Compares two strings.

This method implements a constant-time algorithm to compare strings. Regardless of the used implementation, it will leak length information.

Parameters

string $knownString The string of known length to compare against
string $userInput The string that the user can control

Return Value

bool true if the two strings are the same, false otherwise

static int safeStrlen(string $string)

Returns the number of bytes in a string.

Parameters

string $string The string whose length we wish to obtain

Return Value

int

© 2004–2017 Fabien Potencier
Licensed under the MIT License.
http://api.symfony.com/3.3/Symfony/Component/Security/Core/Util/StringUtils.html