You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Torsten Foertsch <to...@gmx.net> on 2005/05/22 19:29:48 UTC

Re: APR::Base64 Bug

On Sunday 22 May 2005 19:18, Torsten Foertsch wrote:
> there is something wrong with APR::Base64.
>
> r2@opi:~> perl -MAPR::Base64 -MData::Dumper -e '$x=APR::Base64::encode( "x"
> ); print "$x\n".Dumper( [split "", $x] ), "length=".length($x)."\n";' eA==
> $VAR1 = [
>           'e',
>           'A',
>           '=',
>           '=',
>           ''
>         ];
> length=5
> r2@opi:~> perl -MAPR::Base64 -MData::Dumper -e '$x=APR::Base64::encode(
> "xxx" ); print "$x\n".Dumper( [split "", $x] ), "length=".length($x)."\n";'
> eHh4
> $VAR1 = [
>           'e',
>           'H',
>           'h',
>           '4',
>           ''
>         ];
> length=5
>
> In both cases length should be 4 and split("",$x) should return (qw(e a =
> =)).

the attached t/lib/TestAPRlib/base64.pm fails on the bug:

t/apr-ext/base64....1..3
# Running under perl version 5.008005 for linux
# Current time local: Sun May 22 19:24:51 2005
# Current time GMT:   Sun May 22 17:24:51 2005
# Using Test.pm version 1.25
# Using Apache/Test.pm version 1.25
# encoded string: MTIzNDVxd2VydCFAIyQl
# testing : encode
# expected: MTIzNDVxd2VydCFAIyQl
# received: MTIzNDVxd2VydCFAIyQl
not ok 1
# Failed test 1 
in /usr/src/packages/BUILD/mod_perl-2.0.0/t/lib/TestAPRlib/base64.pm at line 
23
# testing : encoded length
# expected: 21
# received: 21
ok 2
# testing : decode
# expected: 12345qwert!@#$%
# received: 12345qwert!@#$%
ok 3
FAILED test 1