Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Q] - Whitespace as the separator – acceptable? #41

Closed
olssonm opened this issue Jun 3, 2021 · 2 comments
Closed

[Q] - Whitespace as the separator – acceptable? #41

olssonm opened this issue Jun 3, 2021 · 2 comments

Comments

@olssonm
Copy link

olssonm commented Jun 3, 2021

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? 🙃

@frozzare
Copy link
Member

frozzare commented Jun 4, 2021

Hey,

Yes, it's a bug and it's not valid with a whitespace.
We will fix it in all packages that have this bug.

Thanks!

@frozzare
Copy link
Member

All packages are fixed/checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants