Skip to content
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

CODABAR not working #92

Closed
robertmylne opened this issue Jan 9, 2020 · 2 comments
Closed

CODABAR not working #92

robertmylne opened this issue Jan 9, 2020 · 2 comments

Comments

@robertmylne
Copy link

When I copy and paste your example:

$generator = new Picqer\Barcode\BarcodeGeneratorHTML();
echo $generator->getBarcode('081231723897', $generator::TYPE_CODE_128);

Everything works great. But when I change the barcode type to codabar it breaks.

$generator = new Picqer\Barcode\BarcodeGeneratorHTML();
echo $generator->getBarcode('081231723897', $generator::TYPE_CODABAR);

With this error:

Line 2038: vendor\picqer\php-barcode-generator\src\BarcodeGenerator.php
ErrorException (E_NOTICE)
Uninitialized string offset: 8

I am a bit lost of how to resolve this issue, do you have any ideas? Thank you :)

@casperbakker
Copy link
Member

This works fine here with PHP 7.3. Which PHP version do you use?

It looks like the 2nd char in the code (8) is casted to an integer somewhere, and then it is strictly checked with the possible chars in the array, which only contains the string '8'. But I cannot reproduce this situation.

I added an extra check for this in d96798a, which will be included in the upcoming version. That could fix something like this, but seems illogical to me.

@robertmylne
Copy link
Author

I used a forked package of yours and it worked for me. Thanks anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants