X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpassword%2FParameterizedPassword.php;h=c92979798fc155a154dc1b67fb7eab29d9184a46;hb=2b7d97e6a49c46eeb0e1018dd51ae5e79b2f373e;hp=4d6e4155263f9a05c37876e3e2ce1bd79a203f8d;hpb=ca28853e225fb8c3a2715c6f5bcc558d9e482590;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/password/ParameterizedPassword.php b/includes/password/ParameterizedPassword.php index 4d6e415526..c92979798f 100644 --- a/includes/password/ParameterizedPassword.php +++ b/includes/password/ParameterizedPassword.php @@ -40,14 +40,14 @@ abstract class ParameterizedPassword extends Password { * Named parameters that have default values for this password type * @var array */ - protected $params = array(); + protected $params = []; /** * Extra arguments that were found in the hash. This may or may not make * the hash invalid. * @var array */ - protected $args = array(); + protected $args = []; protected function parseHash( $hash ) { parent::parseHash( $hash ); @@ -83,10 +83,16 @@ abstract class ParameterizedPassword extends Password { } public function toString() { - return - ':' . $this->config['type'] . ':' . - implode( $this->getDelimiter(), array_merge( $this->params, $this->args ) ) . - $this->getDelimiter() . $this->hash; + $str = ':' . $this->config['type'] . ':'; + + if ( count( $this->params ) || count( $this->args ) ) { + $str .= implode( $this->getDelimiter(), array_merge( $this->params, $this->args ) ); + $str .= $this->getDelimiter(); + } + + $res = $str . $this->hash; + $this->assertIsSafeSize( $res ); + return $res; } /**