PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Images » Image_Barcode » Bug #1986

str_split function problem in code39

Details

Submitted2004-07-26 21:21 UTC
Fromjason at nothanks dot com
Assignedmsmarcal
StatusClosed
PackageImage_Barcode
PHP Version0.5
OSlinux
Roadmaps(Not assigned)

Comments

[2004-07-26 21:21 UTC] jason at nothanks dot com

Description:
------------
The str_split is already in php5, so it pulls an error when you try to create a code39 barcode.

Here's a quick fix:

if(!function_exists('str_split')){
function str_split( $str, $num = '1' ) {
if($num < 1) return FALSE;
$arr = array();
for ($j = 0; $j < strlen($str); $j= $j+$num) {
$arr[] = substr($str,$j,$num);
}
return $arr;
}}

Reproduce code:
---------------
.

Expected result:
----------------
.

Actual result:
--------------
.

[2004-10-14 08:07 UTC] scragz at hotmail dot com

PEAR's PHP_Compat can declare this function as well, which is how I ran into the conflict.

[2005-04-11 21:09 UTC] jason at unleashed dot com dot br

Thank you for your bug report. This issue has been fixed
in the latest released version of the package, which you can download at
http://pear.php.net/get/Image_Barcode

Fixed in release 1.0.0