Issues

ZF-9170: Add Code128 object to Zend_Barcode

Issue Type: Improvement Created: 2010-02-14T07:19:20.000+0000 Last Updated: 2012-02-29T18:57:48.000+0000 Status: Resolved Fix version(s): - 1.11.0 (02/Nov/10)

Reporter: Mickael Perraud (mikaelkael) Assignee: Mickael Perraud (mikaelkael) Tags: - Zend_Barcode

Related issues: - ZF-10269

Attachments: - Code128.php

Description

Add Code128 object to Zend_Barcode (A, B and C)

Comments

Posted by Stephan Wienczny (wienczny) on 2010-09-22T09:55:56.000+0000

I've found a small bug in the _isDigit. In some cases when switching to C the function returned wrong values.

This should fix the bug:

protected static function _isDigit($string, $pos, $length = 2) { if ($pos + $length > strlen($string)) { return false; }

for ($i = $pos; $i < $pos + $length; $i++) {
  if (!is_numeric($string[$i])) {
    return false;
  }
}
return true;

}

Posted by Mickael Perraud (mikaelkael) on 2010-09-22T10:29:22.000+0000

Hi Stephan, Can you give example of errors to be able to add a unit test to cover it? Thanks in advance

Posted by Stephan Wienczny (wienczny) on 2010-09-22T10:42:36.000+0000

The error was this:

When a number like -123, where $string[$pos] == '-', was given to _isDigit it returned true because the '-' sign was interpreted as part of the number. If _isDigit returns true for this example the code-table is changed to C, but C does not contain '-'. The lookup fails and depending on the php-configuration a wrong or no barcode is generated.

I hope this explains the bug.

Posted by Mickael Perraud (mikaelkael) on 2010-09-22T10:54:24.000+0000

Perfectly, thanks!

Posted by Mickael Perraud (mikaelkael) on 2010-09-23T13:43:07.000+0000

Implemented with r22998

Posted by Laurens van Vliet (laurens_at_hol) on 2010-10-28T07:35:14.000+0000

I need to draw a barcode with code128. I'm using Code128.php ZF 1.11.0rc1 because I found out that in earlier stable ZF versions Code128 is not included.

When I don't set any options and draw a code128 barcode image it looks okay. When I set the barThickWidth => 6 and barThinWidth => 2, the image gets twice as wide while the bar widths are exactly the same as with the default 3 and 1 widths. Only the total image gets twice as wide, but not the actual bars. The left side of the image gets filled with the bars and the right side is just plain white.

Can someone help me to fix this?

Posted by Mickael Perraud (mikaelkael) on 2010-10-28T08:06:36.000+0000

@Laurens: i will look to this problem rapidly but can you open a new issue for this, please? Thanks in advance.

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts