From: Reedy Date: Mon, 16 Nov 2015 20:47:15 +0000 (+0000) Subject: Improve error message if check not defined for a password policy. X-Git-Tag: 1.31.0-rc.0~8983^2 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=c3b35bb187d99d77d9363ce9d0ccde1e1e063ffa;p=lhc%2Fweb%2Fwiklou.git Improve error message if check not defined for a password policy. Bug: T118776 Change-Id: Ic1826f15424197545f4d6c2b1af49adbc4289e15 --- diff --git a/includes/password/UserPasswordPolicy.php b/includes/password/UserPasswordPolicy.php index 80dc66920d..d57adb8e15 100644 --- a/includes/password/UserPasswordPolicy.php +++ b/includes/password/UserPasswordPolicy.php @@ -56,7 +56,7 @@ class UserPasswordPolicy { foreach ( $checks as $statement => $check ) { if ( !is_callable( $check ) ) { throw new InvalidArgumentException( - 'Policy check functions must be callable' + "Policy check functions must be callable. '$statement' isn't callable." ); } $this->policyCheckFunctions[$statement] = $check; @@ -105,11 +105,18 @@ class UserPasswordPolicy { ); } + /** + * @param User $user + * @param string $password + * @param array $policies + * @param array $policyCheckFunctions + * @return Status + */ private function checkPolicies( User $user, $password, $policies, $policyCheckFunctions ) { $status = Status::newGood(); foreach ( $policies as $policy => $value ) { if ( !isset( $policyCheckFunctions[$policy] ) ) { - throw new DomainException( 'Invalid password policy config' ); + throw new DomainException( "Invalid password policy config. No check defined for '$policy'." ); } $status->merge( call_user_func(