PrimitiveTypeConstraintValidator does not validate some values correctly

Created on 24 November 2013, about 11 years ago
Updated 11 April 2024, 9 months ago

This is a subissue of #2012776: [META] Improve validation constraint test coverage β†’

Problem/Motivation

The PrimitiveTypeConstraintValidator still gives the wrong result for some input values:

  • TRUE with the float and integer validators due to type casting leading to odd behavior with filter_var()
  • An object with the URI validator as it assumes we pass in a string.
  • Booleans with the string validator as it accepts all scalars
  • seems like this may be desired as making this a validation failure makes a whole bunch of tests fail? can we document why so?

It is also unclear why we validate some strings as integers and some integers as strings.

Proposed resolution

  • Add tests
  • Document the "odd" behavior of the validator in the tests where it is warranted
  • Add stricter checking to the validator where necessary

Remaining tasks

Review patch

User interface changes

N/A

API changes

N/A

πŸ› Bug report
Status

Postponed: needs info

Version

11.0 πŸ”₯

Component
Typed dataΒ  β†’

Last updated 16 days ago

  • Maintained by
  • πŸ‡¦πŸ‡ΉAustria @fago
Created by

πŸ‡·πŸ‡΄Romania mariancalinro

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡³πŸ‡ΏNew Zealand quietone

    Work on this issue stopped about 9 years ago. It is time to check if this is still relevant for Drupal 10?

    Since we need more information to move forward with this issue, I am setting the status to Postponed (maintainer needs more info). If we don't receive additional information to help with the issue, it may be closed after three months.

    Thanks!

  • Status changed to Needs work 9 months ago
  • The Needs Review Queue Bot β†’ tested this issue.

    While you are making the above changes, we recommend that you convert this patch to a merge request β†’ . Merge requests are preferred over patches. Be sure to hide the old patch files as well. (Converting an issue to a merge request without other contributions to the issue will not receive credit.)

  • Status changed to Postponed: needs info 9 months ago
  • πŸ‡³πŸ‡ΏNew Zealand quietone
  • πŸ‡ΊπŸ‡ΈUnited States nicxvan
Production build 0.71.5 2024