}
public function validate( $value, $alldata ) {
+ // Default value (from getDefault()) is null, User::newFromName() expects a string
+ if ( $value === null ) {
+ $value = '';
+ }
+
// check, if a user exists with the given username
$user = User::newFromName( $value, false );
$rangeError = null;
} elseif (
// check, if the user exists, if requested
( $this->mParams['exists'] && $user->getId() === 0 ) &&
- // check, if the username is a valid IP address, otherweise save the error message
+ // check, if the username is a valid IP address, otherwise save the error message
!( $this->mParams['ipallowed'] && IP::isValid( $value ) ) &&
// check, if the username is a valid IP range, otherwise save the error message
!( $this->mParams['iprange'] && ( $rangeError = $this->isValidIPRange( $value ) ) === true )