Error with Code 11 using check digit K
Closed this issue · 6 comments
Hi there!
I have found an error when creating a barcode of type "Code 11", which is at least 10 characters long. In that case, the check digit K is calculated and always (under all circumstances) throws an error.
The damaged code is in \Picqer\Barcode\Types\TypeCode11::getCheckDigitK() on line 94 (for ($i = strlen($code); $i >= 0; --$i) {
), throwing an error on line 95 ($digit = $code[$i];
).
E.g., if the code is 11 characters long (check digit C already included), the code tries to get the 12. character.
A solution (which is already implemented in ::getCheckDigitC(), for example) would be for ($i = (strlen($code) - 1); $i >= 0; --$i) {
.
Kind regards,
Bernhard
@Bernhard-Krop Could you maybe create PR's for these suggestions? Your suggestions are so good until now, that I would merge them right away. :)
@casperbakker Yes, I can do that. I'm currently on some work for another project. This work should be done next week. Afterwards, I will work on the PR's for the issues I've opened.
Have a nice weekend!
@Bernhard-Krop No need to hurry. :) This is just a fun project. But if you have the time, PR's are much appreciated so we can make this package better and better.
Nice weekend to you as well!
@casperbakker Unfortunately, I got some new work on my desk with higher priority to my company. So it will take some more time until I can work on the PRs. As soon as I have the time to work on them, I will provide them here in the project.
@casperbakker Hi there! I just provided a PR for this issue. I'm immediatley work on the next one.
@Bernhard-Krop Very nice. Thank you so much!