ZF-4747: Zend_Validate_Barcode::isValid($ean13) incorrectly assumes $ean13 only contains valid characters
Description
note Consider this post Public Domain.
//example of incorrect assumption leading to wrong result $invalid_ean13 = 'Tree to Table'; $validate = new Zend_Validate_Barcode('ean13'); $valid = $validate->isValid($invalid_ean13); if ( $valid ) { die('this is very wrong'); }
//suggested solution, insert at start of isValid() in Zend/Validate/Barcode/Ean13.php $valueString = preg_replace("/[^0-9]/i", '', $valueString);
Comments
Posted by Dave Hall (skwashd) on 2008-10-29T21:21:01.000+0000
The preg_replace should be preg_replace("/[^0-9]/i", '', $valueString);
I suspect you are getting ISBN10 and EAN13/ISBN13 confused :)
Posted by Thomas Weidner (thomas) on 2008-11-06T12:18:09.000+0000
Fixed with r11791 by andries.
Posted by Wil Sinclair (wil) on 2008-11-13T14:10:11.000+0000
Changing issues in preparation for the 1.7.0 release.