-
-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Description
Howdy! Writing some tests for a PHP-package I'm maintaining olssonm/swedish-entity that's built upon personnummer/php and I've encountered an oddity.
A whitespace as the separator seems to be accepted at the moment; i.e. 600411 8177
(or even with a tab instead of space) is returned as valid. This seems to be from the regex that's being used (I've only checked the PHP and JS-packages);
$reg = '/^(?\'century\'\d{2}){0,1}(?\'year\'\d{2})(?\'month\'\d{2})(?\'day\'\d{2})(?\'sep\'[\+\-\s]?)(?\'num\'(?!000)\d{3})(?\'check\'\d)$/';
There the separator, (?\'sep\'[\+\-\s]?)
, accepts +,- or whitespace.
The thing is though; I can't find any references that a whitespace should be valid for use in a personnummer or what the meaning would be.
Is this intended behaviour, or am I missing something? 🙃