Re: Image_Barcode maintainer request

From: Date: Thu, 04 Feb 2010 18:43:04 +0000
Subject: Re: Image_Barcode maintainer request
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.pear.qa 
Request: Send a blank email to pear-qa+get-5589@lists.php.net to get a copy of this message
Hi Christian, On Thu, Jan 28, 2010 at 2:24 AM, Adrian <adrian.mugica@gmail.com> wrote: > Hi Christian > >>> >> I've attached a revised patch for Request #10594. >>> > I see you did not test the patch at all, otherwise you would have >>> > seen that it does not work. That's a bad start I would say. >>> yeah, I didn't test in PHP4, just 5. It is embarrassingly not a good >>> start. This re-affirms the importance of testing for me. >> It did not even work in PHP5 anymore, since there was no image returned >> at all with your patch. > It works in PHP5 on my system. I've set up a PHP4 test environment and > it works there too. I've tested (through a web browser) both sending > the image to the browser and having the $img var returned. > If you apply the patch you should see that $img is set to null within > "if($bSendToBrowser)" > where it would not be returned but sent to the browser (before being > set to null) through one of the imagexxx functions depending on what > the $imgtype in the "switch" > and "return $img" is at the end of the function outside of > if($bSendToBrowser) where it would not be set to null. > > I can see how by looking at the patch it may seem like "$img = null;" > is outside of the "if", but it remains inside since my patch removes > the "else". > > If it doesn't work for you after applying the patch, then maybe i'm > not working with the same Barcode.php file as you? I believe I'm using > version 1.1.0 the current stable release version. > > please confirm. > Any update on this? can you apply the patch and confirm that it works or that it does not. >> >> >>> I will do some unit testing and submit the tests and fix the patch. >>> I'll email once I've done it. >> We're always there to help - if there is any problem or thing you don't >> understand or liked to know, ask pear-dev@lists.php.net or join us in >> #pear on efnet IRC. > Here is the phpt test I made, I wasn't sure what to do for testing > images sent to browser, so I just made the test write the images to > files. I commented the unlink in the cleanup and viewed the files to > make sure they were the correctly generated. > > --TEST-- > draw() tests > --FILE-- > <?php >    error_reporting(E_ALL); >    require('Image/Barcode.php'); >    $true_results = array(); >    $false_results = array(); >    $bc = new Image_Barcode(); >   >  foreach(array('Code39','code128','ean13','int25','postnet','upca') > as $bc_type){ >        foreach(array('gif','jpg','png') as $img_type){ >            $img_res = $bc->draw('123456789012', $bc_type, $img_type, false); >            $img_func = 'image'.(($img_type == 'jpg')? > 'jpeg':$img_type); >            $result = $img_func($img_res, > 'test_'.$bc_type.'.'.$img_type); >            if($result == true){ >                $true_results[] = $result; >            }else{ >                $false_results[] = $result; >            } >        } >    } >    echo count($true_results)."\n"; >    echo count($false_results)."\n"; > ?> > --EXPECT-- > 18 > 0 > --CLEAN-- > <?php >   >  foreach(array('Code39','code128','ean13','int25','postnet','upca') > as $bc_type){ >        foreach(array('gif','jpg','png') as $img_type){ >            unlink('test_'.$bc_type.'.'.$img_type); >        } >    } > ?> > > > Thanks, Adrian Mugica

« previous php.pear.qa (#5589) next »