Merge branch '5.0'
* 5.0: Fix #35385: Fix Console typehint Fix RememberMe with null password [String] add missing encoding when calling mb_ord()
This commit is contained in:
commit
52f77d2a93
@ -104,7 +104,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function getArgument($name)
|
public function getArgument(string $name)
|
||||||
{
|
{
|
||||||
if (!$this->definition->hasArgument($name)) {
|
if (!$this->definition->hasArgument($name)) {
|
||||||
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
|
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
|
||||||
@ -116,7 +116,7 @@ abstract class Input implements InputInterface, StreamableInputInterface
|
|||||||
/**
|
/**
|
||||||
* {@inheritdoc}
|
* {@inheritdoc}
|
||||||
*/
|
*/
|
||||||
public function setArgument($name, $value)
|
public function setArgument(string $name, $value)
|
||||||
{
|
{
|
||||||
if (!$this->definition->hasArgument($name)) {
|
if (!$this->definition->hasArgument($name)) {
|
||||||
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
|
throw new InvalidArgumentException(sprintf('The "%s" argument does not exist.', $name));
|
||||||
|
@ -91,12 +91,12 @@ class TokenBasedRememberMeServices extends AbstractRememberMeServices
|
|||||||
/**
|
/**
|
||||||
* Generates the cookie value.
|
* Generates the cookie value.
|
||||||
*
|
*
|
||||||
* @param int $expires The Unix timestamp when the cookie expires
|
* @param int $expires The Unix timestamp when the cookie expires
|
||||||
* @param string $password The encoded password
|
* @param string|null $password The encoded password
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function generateCookieValue(string $class, string $username, int $expires, string $password)
|
protected function generateCookieValue(string $class, string $username, int $expires, ?string $password)
|
||||||
{
|
{
|
||||||
// $username is encoded because it might contain COOKIE_DELIMITER,
|
// $username is encoded because it might contain COOKIE_DELIMITER,
|
||||||
// we assume other values don't
|
// we assume other values don't
|
||||||
@ -111,12 +111,12 @@ class TokenBasedRememberMeServices extends AbstractRememberMeServices
|
|||||||
/**
|
/**
|
||||||
* Generates a hash for the cookie to ensure it is not being tampered with.
|
* Generates a hash for the cookie to ensure it is not being tampered with.
|
||||||
*
|
*
|
||||||
* @param int $expires The Unix timestamp when the cookie expires
|
* @param int $expires The Unix timestamp when the cookie expires
|
||||||
* @param string $password The encoded password
|
* @param string|null $password The encoded password
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function generateCookieHash(string $class, string $username, int $expires, string $password)
|
protected function generateCookieHash(string $class, string $username, int $expires, ?string $password)
|
||||||
{
|
{
|
||||||
return hash_hmac('sha256', $class.self::COOKIE_DELIMITER.$username.self::COOKIE_DELIMITER.$expires.self::COOKIE_DELIMITER.$password, $this->getSecret());
|
return hash_hmac('sha256', $class.self::COOKIE_DELIMITER.$username.self::COOKIE_DELIMITER.$expires.self::COOKIE_DELIMITER.$password, $this->getSecret());
|
||||||
}
|
}
|
||||||
|
@ -172,7 +172,17 @@ abstract class AbstractUnicodeString extends AbstractString
|
|||||||
{
|
{
|
||||||
$str = $this->slice($offset, 1);
|
$str = $this->slice($offset, 1);
|
||||||
|
|
||||||
return '' === $str->string ? [] : array_map('mb_ord', preg_split('//u', $str->string, -1, PREG_SPLIT_NO_EMPTY));
|
if ('' === $str->string) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
$codePoints = [];
|
||||||
|
|
||||||
|
foreach (preg_split('//u', $str->string, -1, PREG_SPLIT_NO_EMPTY) as $c) {
|
||||||
|
$codePoints[] = mb_ord($c, 'UTF-8');
|
||||||
|
}
|
||||||
|
|
||||||
|
return $codePoints;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function folded(bool $compat = true): parent
|
public function folded(bool $compat = true): parent
|
||||||
|
@ -79,7 +79,7 @@ class CodePointString extends AbstractUnicodeString
|
|||||||
{
|
{
|
||||||
$str = $offset ? $this->slice($offset, 1) : $this;
|
$str = $offset ? $this->slice($offset, 1) : $this;
|
||||||
|
|
||||||
return '' === $str->string ? [] : [mb_ord($str->string)];
|
return '' === $str->string ? [] : [mb_ord($str->string, 'UTF-8')];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function endsWith($suffix): bool
|
public function endsWith($suffix): bool
|
||||||
|
Reference in New Issue
Block a user