PHP :: Bug #75825 :: mailparse_uudecode_all doesn't parse multiple files
php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75825 mailparse_uudecode_all doesn't parse multiple files
Submitted: 2018-01-16 16:52 UTC Modified: -
From: cmanley at xs4all dot nl Assigned:
Status: Open Package: mailparse (PECL)
PHP Version: 7.0.27 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: cmanley at xs4all dot nl
New email:
PHP Version: OS:

 

 [2018-01-16 16:52 UTC] cmanley at xs4all dot nl
Description:
------------
---
From manual page: http://www.php.net/function.mailparse-uudecode-all
---
If a uuencoded mail contains multiple files, then mailparse_uudecode_all() only parses the first found file and ignores the rest.

Test script:
---------------
<?php
# Save with UNIX line endings:
$data = <<<'EOD'
begin 644 .profile
M(R!^+RYP<F]F:6QE.B!E>&5C=71E9"!B>2!T:&4@8V]M;6%N9"!I;G1E<G!R
M971E<B!F;W(@;&]G:6X@<VAE;&QS+@HC(%1H:7,@9FEL92!I<R!N;W0@<F5A
M9"!B>2!B87-H*#$I+"!I9B!^+RYB87-H7W!R;V9I;&4@;W(@?B\N8F%S:%]L
M;V=I;@HC(&5X:7-T<RX*(R!S964@+W5S<B]S:&%R92]D;V,O8F%S:"]E>&%M
M<&QE<R]S=&%R='5P+69I;&5S(&9O<B!E>&%M<&QE<RX*(R!T:&4@9FEL97,@
M87)E(&QO8V%T960@:6X@=&AE(&)A<V@M9&]C('!A8VMA9V4N"@HC('1H92!D
M969A=6QT('5M87-K(&ES('-E="!I;B`O971C+W!R;V9I;&4[(&9O<B!S971T
M:6YG('1H92!U;6%S:PHC(&9O<B!S<V@@;&]G:6YS+"!I;G-T86QL(&%N9"!C
M;VYF:6=U<F4@=&AE(&QI8G!A;2UU;6%S:R!P86-K86=E+@HC=6UA<VL@,#(R
M"@HC(&EF(')U;FYI;F<@8F%S:`II9B!;("UN("(D0D%32%]615)324].(B!=
M.R!T:&5N"B`@("`C(&EN8VQU9&4@+F)A<VAR8R!I9B!I="!E>&ES=',*("`@
M(&EF(%L@+68@(B1(3TU%+RYB87-H<F,B(%T[('1H96X*"2X@(B1(3TU%+RYB
M87-H<F,B"B`@("!F:0IF:0H*(R!S970@4$%42"!S;R!I="!I;F-L=61E<R!U
M<V5R)W,@<')I=F%T92!B:6X@:68@:70@97AI<W1S"FEF(%L@+60@(B1(3TU%
M+V)I;B(@72`[('1H96X*("`@(%!!5$@](B1(3TU%+V)I;CHD4$%42"(*9FD*
`
end
begin 644 .bash_logout
M(R!^+RYB87-H7VQO9V]U=#H@97AE8W5T960@8GD@8F%S:"@Q*2!W:&5N(&QO
M9VEN('-H96QL(&5X:71S+@H*(R!W:&5N(&QE879I;F<@=&AE(&-O;G-O;&4@
M8VQE87(@=&AE('-C<F5E;B!T;R!I;F-R96%S92!P<FEV86-Y"@II9B!;("(D
M4TA,5DPB(#T@,2!=.R!T:&5N"B`@("!;("UX("]U<W(O8FEN+V-L96%R7V-O
H;G-O;&4@72`F)B`O=7-R+V)I;B]C;&5A<E]C;VYS;VQE("UQ"F9I"@``
`
end
begin 644 .selected_editor
`
end

EOD;
$h = fopen('data://text/plain,' . $data, 'r');
$h || die("Failed to open string!\n");
$parsed = mailparse_uudecode_all($h);
fclose($h);
print_r($parsed);


Expected result:
----------------
Array
(
    [0] => Array
        (
            [filename] => /tmp/mailparseVPoFAd
        )

    [1] => Array
        (
            [origfilename] => .profile
            [filename] => /tmp/mailparseQgOwZu
        )
    [2] => Array
        (
            [origfilename] => .bash_logout
            [filename] => /tmp/mailparseBLAAAA
        )
    [3] => Array
        (
            [origfilename] => .selected_editor
            [filename] => /tmp/mailparseFOOOOO
        )
)

Actual result:
--------------
Array
(
    [0] => Array
        (
            [filename] => /tmp/mailparseVPoFAd
        )

    [1] => Array
        (
            [origfilename] => .profile
            [filename] => /tmp/mailparseQgOwZu
        )

)

Patches

Add a Patch

Pull Requests

Add a Pull Request

 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Fri Aug 17 06:01:24 2018 UTC