Bug->Doc #72113 [Opn->Ver]: convert_uudecode() fails to decode data

From: Date: Sat, 05 May 2018 11:43:48 +0000
Subject: Bug->Doc #72113 [Opn->Ver]: convert_uudecode() fails to decode data
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15648@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72113&edit=1

 ID:                 72113
 Updated by:         cmb@php.net
 Reported by:        christian at rishoj dot net
 Summary:            convert_uudecode() fails to decode data
-Status:             Open
+Status:             Verified
-Type:               Bug
+Type:               Documentation Problem
 Package:            Strings related
 Operating System:   Linux and OS X
 PHP Version:        7.0.5
-Assigned To:        
+Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

> It seems to be Uuencoding header that trips the function up.

That!  convert_uuencode() doesn't produce the file header/footer,
and as such convert_uudecode() doesn't expect these.  Actually,
both functions only handle a single data line.  The rest is up to
the developer.


Previous Comments:
------------------------------------------------------------------------
[2016-04-28 14:27:44] christian at rishoj dot net

It seems to be Uuencoding header that trips the function up.

This decodes properly:

$encoded = '&<&QA:6X*';

echo convert_uudecode($encoded);
// plain

https://3v4l.org/XKKPX


With the header, it just produces an "r";

$encoded = 'begin 644 test.txt
&<&QA:6X*
`
end';

echo convert_uudecode($encoded);
// r

https://3v4l.org/PWMIQ

------------------------------------------------------------------------
[2016-04-28 13:52:53] jhdxr@php.net

https://3v4l.org/IJGeD

<?php

$encoded = 'M2$%4($-!3B=4($)%($)%050B.R(B.R)#1"!!3$)532([.#DN,#`[,3LR,#$V
:,#4R-SLB3B([,#LB3$]#04PB.R)01TTB#0I!';

echo convert_uudecode($encoded);
//HAT CAN'T BE BEAT";"";"CD
ALBUM";89.00;1;20160527;"N";0;"LOCAL";"PGM"

------------------------------------------------------------------------
[2016-04-27 21:48:58] christian at rishoj dot net

Description:
------------
PHP's convert_uudecode() fails to decode the following snippet of unencoded data:

begin 644 decoded.txt
M2$%4($-!3B=4($)%($)%050B.R(B.R)#1"!!3$)532([.#DN,#`[,3LR,#$V
:,#4R-SLB3B([,#LB3$]#04PB.R)01TTB#0I!
`
end

Both GNU's uudecode and Perl's uudecode successfully decode the data, but the
implementation in PHP simply produces an "r".

Test script:
---------------
<?php

$encoded = "begin 644 decoded.txt
M2$%4($-!3B=4($)%($)%050B.R(B.R)#1"!!3$)532([.#DN,#`[,3LR,#$V
:,#4R-SLB3B([,#LB3$]#04PB.R)01TTB#0I!
`
end";

echo convert_uudecode($encoded);


Expected result:
----------------
HAT CAN'T BE BEAT";"";"CD
ALBUM";89.00;1;20160527;"N";0;"LOCAL";"PGM"


Actual result:
--------------
r


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=72113&edit=1


Thread (2 messages)

« previous php.doc.bugs (#15648) next »