8000 [Validator] IsbnValidator is not conform to the documentation · Issue #10386 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content
[Validator] IsbnValidator is not conform to the documentation #10386
Closed
@konandrum

Description

@konandrum

This is what is writing in the documentation:

isbn10¶
type: boolean
If this required option is set to true the constraint will check if the code is a valid ISBN-10 code.

isbn13¶
type: boolean
If this required option is set to true the constraint will check if the code is a valid ISBN-13 code.

Here is the code:

if (10 === $valueLength && null !== $constraint->isbn10) {
...
} elseif (13 === $valueLength && null !== $constraint->isbn13) {
...
} else {
...
}

The problem is when I set to false the isbn10 and to true the isbn13 parameters, I get the bothIsbnMessage instead of the isbn13Message.

I suggest to change the code like this:

if (10 === $valueLength && $constraint->isbn10) {
...
} elseif (13 === $valueLength && $constraint->isbn13) {
...
} else {
...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0