That must be a exact 31 characters, not 31 characters at once in a
longer string
Remove upper characters, because database contains only lower characters
and there is no strtolower
Change-Id: Ic980fd719955842fad30a315eedd71381caf8aa5
* @return bool
*/
public function validateSha1Hash( $hash ) {
- return preg_match( '/[a-fA-F0-9]{40}/', $hash );
+ return preg_match( '/^[a-f0-9]{40}$/', $hash );
}
/**
* @return bool
*/
public function validateSha1Base36Hash( $hash ) {
- return preg_match( '/[a-zA-Z0-9]{31}/', $hash );
+ return preg_match( '/^[a-z0-9]{31}$/', $hash );
}
/**