8000 fix #10386 isbnValidator so to allow to specify with false any isbn10 or 113 by cordoval · Pull Request #10387 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

fix #10386 isbnValidator so to allow to specify with false any isbn10 or 113 #10387

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

Conversation

cordoval
Copy link
Contributor
@cordoval cordoval commented Mar 5, 2014
Q A
Bug Fix? yes
New Feature? no
BC Breaks? no
Deprecations? no
Tests Pass? yes
Fixed Tickets #10386
License MIT
Doc PR nope

isbnValidator so to allow to specify with false any isbn10 or 13

@jakzal
Copy link
Contributor
jakzal commented Mar 11, 2014

Shouldn't these options be exclusive (either one or the other should be set)? What if you set both of them to true? Can a number be both isbn10 and 13 valid?

@sprain
Copy link
Contributor
sprain commented Mar 19, 2014

I agree, they should be exclusive.

Some time ago I rewrote this validator like this:
https://github.com/sprain/SprainValidatorBundle/blob/master/Validator/Constraints/IsbnValidator.php
https://github.com/sprain/SprainValidatorBundle/blob/master/Resources/doc/validators/isbn.md

I'd suggest this is a better approach.

@fabpot
Copy link
Member
fabpot commented Mar 26, 2014

@sprain Can you submit a pull request?

@fabpot fabpot closed this Mar 26, 2014
fabpot added a commit that referenced this pull request Mar 27, 2014
This PR was merged into the 2.5-dev branch.

Discussion
----------

[Validator] Improved ISBN validator

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | #10386, #10387, #10542
| License       | MIT
| Doc PR        | symfony/symfony-docs/pull/3724

This is a new PR of #10542, now on master branch.

Todos:
- [x] Discuss and determine deprecation versions
- [x] Update docs

After following some discussion in the tickets mentioned above I have improved the ISBN validator, which has had some inconsistencies:

* Use a `type` which can be set to `isbn10` or `isbn13` or `null` (checks if value matches any type) instead of the current boolean `isbn10` and `isbn13` options which cause confusion (e.q. if both are true, does this mean the value must match any or both? You could think it's the latter, but that's actually impossible.).
* In the IBAN validator we recently agreed to be strict about upper- and lowercase handling (#10489). Therefore this should be also the case with the ISBN validator. Some ISBN10 numbers may end with an uppercase `X` (representing the check-digit 10), while a lowercase `x` is considered wrong (see [here](http://www.goodreads.com/topic/show/1253500-a-question-about-isbn-10-s---ending-in-x) and [here](http://en.wikipedia.org/wiki/Category:Pages_with_ISBN_errors)). I did not have access to the actual specifications as I have only found documentation which costs about $100 (e.q. [here](http://www.iso.org/iso/catalogue_detail?csnumber=36563)).

To avoid bc breaks I suggest to introduce deprecations for current constraint options. [In the documentation](http://symfony.com/doc/current/contributing/code/conventions.html#deprecations) I haven't found any information about which versions may introduce deprecations, so you might have to help me out here with hints on how to handle it correctly. I'll be happy to provide the code with the deprecated parts removed after that.

Commits
-------

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

Successfully merging this pull request may close these issues.

4 participants
0