Bug description
Faker\Core\Barcode::isbn13() can produce barcodes starting with 9790,
which is the reserved prefix for ISMN (International Standard Music Number),
not ISBN-13.
Root cause
The current implementation picks randomly between prefix 978 and 979,
then appends 9 fully random digits. When the prefix is 979 and the first
appended digit is 0, the result passes EAN-13 checksum validation but is
not a valid ISBN-13.
Expected behavior
isbn13() should only produce codes with prefix 978 or 9791–9799.
Steps to reproduce
Call isbn13() a large number of times and check if any result starts with 9790.
Valid ISBN-13 prefixes
| Prefix |
Valid? |
978 + 9d |
✅ ISBN-13 |
9791–9799 + 8d |
✅ ISBN-13 |
9790 + 8d |
❌ ISMN |
Bug description
Faker\Core\Barcode::isbn13()can produce barcodes starting with9790,which is the reserved prefix for ISMN (International Standard Music Number),
not ISBN-13.
Root cause
The current implementation picks randomly between prefix
978and979,then appends 9 fully random digits. When the prefix is
979and the firstappended digit is
0, the result passes EAN-13 checksum validation but isnot a valid ISBN-13.
Expected behavior
isbn13()should only produce codes with prefix978or9791–9799.Steps to reproduce
Call
isbn13()a large number of times and check if any result starts with9790.Valid ISBN-13 prefixes
978+ 9d9791–9799+ 8d9790+ 8d