Bug #3067

Numeric validators accept strings with spaces

Added by Davide Principi over 4 years ago. Updated over 4 years ago.

Status:CLOSEDStart date:
Priority:NormalDue date:
Assignee:-% Done:

100%

Category:-
Target version:v1.6.2
Security class: Resolution:
Affected version:v1.6.2 NEEDINFO:No

Description

Numeric validators accept input strings containing spaces and numbers (like " 255" or "255 ").
Affected validator
  • greatThan
  • lessThan
  • integer
  • positive
  • negative

Expected behavior

Validator must fail with strings like " 255" and "255 ".


Related issues

Related to NethServer 6 - Enhancement #3044: MultiWAN: restrict validator for weight field CLOSED
Copied from NethServer 6 - Bug #3049: Integer validator accepts strings containing number and b... CLOSED

Associated revisions

Revision 488c88e2
Added by Davide Principi over 4 years ago

Fixed numeric and integer validators. Refs #3067

- Changed test rule: "123.0" is not an integer value: dot is not
allowed. Refs #3067

Revision f400c861
Added by Davide Principi over 4 years ago

ValidatorTest: added more strict tests. Refs #3067

History

#1 Updated by Davide Principi over 4 years ago

  • Copied from Bug #3049: Integer validator accepts strings containing number and beginning with spaces added

#2 Updated by Davide Principi over 4 years ago

#3 Updated by Davide Principi over 4 years ago

  • Subject changed from Validator accepts strings containing number and beginning with spaces to Numeric validators accept strings with spaces
  • Status changed from NEW to TRIAGED
  • % Done changed from 0 to 20
  • Resolution deleted (CANTFIX)

PHP type juggling is tricky

We must ensure the input value represents a number that satisfies the following regexp: [0-9]+(\.[0-9]+)?

The integer() validator can be applied to restrict values to [0-9]+

#4 Updated by Davide Principi over 4 years ago

  • Status changed from TRIAGED to ON_DEV
  • Assignee set to Davide Principi
  • % Done changed from 20 to 30

#5 Updated by Davide Principi over 4 years ago

  • Status changed from ON_DEV to MODIFIED
  • Assignee deleted (Davide Principi)
  • % Done changed from 30 to 60

#6 Updated by Davide Principi over 4 years ago

  • Status changed from MODIFIED to ON_QA
  • % Done changed from 60 to 70

In nethserver-testing 6.6:
nethserver-httpd-admin-1.3.6-2.29.g80bb1dd.ns6.noarch.rpm

#7 Updated by Giacomo Sanchietti over 4 years ago

  • Status changed from ON_QA to VERIFIED
  • % Done changed from 70 to 90

#8 Updated by Davide Principi over 4 years ago

  • Status changed from VERIFIED to CLOSED
  • % Done changed from 90 to 100

Was released in nethserver-httpd-admin-1.3.8-1.ns6.noarch

Also available in: Atom PDF