BSN 0 and 00000000 validate as valid, but are invalid BSN numbers.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

JoshaHubbers created an issue. See original summary.

JoshaHubbers’s picture

FileSize
819 bytes

empty validates 0 as valid. Isset will do.

paulvandenburg’s picture

Assigned: JoshaHubbers » Unassigned
Status: Active » Needs review
FileSize
769 bytes

Added a minor improvement to the validation, but functionally it was good.

askibinski’s picture

Status: Needs review » Needs work

The empty function was used to handle usecases when the BSN field is not required. However, in this case it would indeed result in '0' returning a valid BSN number because 0 returns true in empty(). The !isset() does not fix this because it never triggers (it is always set even if empty).

The check needs to be different in case the field is left empty.

askibinski’s picture

Status: Needs work » Needs review
FileSize
768 bytes
paulvandenburg’s picture

Status: Needs review » Reviewed & tested by the community

Tested a non required empty bsn field which works again with the patch.
0 and 00000000 are still caught as invalid.

ralphvdhoudt’s picture

Status: Reviewed & tested by the community » Fixed
ralphvdhoudt’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.