Annotation of embedaddon/php/ext/standard/tests/streams/bug64166_2.phpt, revision 1.1

1.1     ! misho       1: --TEST--
        !             2: Bug #64166: quoted-printable-encode stream filter incorrectly discarding whitespace - split reads
        !             3: --FILE--
        !             4: <?php
        !             5: 
        !             6: function test_64166($data) {
        !             7:     $fd = fopen('php://temp', 'w+');
        !             8:     fwrite($fd, $data);
        !             9:     rewind($fd);
        !            10: 
        !            11:     $res = stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array(
        !            12:                'line-break-chars' => "\n",
        !            13:                'line-length' => 74
        !            14:     ));
        !            15:     $str = "";
        !            16:     while(($c = fread($fd, 1))!= "") $str .= $c; 
        !            17:     var_dump($str);
        !            18: 
        !            19:     stream_filter_remove($res);
        !            20: 
        !            21:     rewind($fd);
        !            22:     stream_filter_append($fd, 'convert.quoted-printable-encode', STREAM_FILTER_READ, array(
        !            23:                'line-break-chars' => "\n",
        !            24:                'line-length' => 6
        !            25:     ));
        !            26:     $str = "";
        !            27:     while(($c = fread($fd, 1))!= "") $str .= $c;
        !            28:     var_dump($str);
        !            29: 
        !            30:     fclose($fd);
        !            31: }
        !            32: 
        !            33: test_64166("FIRST \nSECOND");
        !            34: test_64166("FIRST  \nSECOND");
        !            35: 
        !            36: ?>
        !            37: --EXPECT--
        !            38: string(15) "FIRST=20
        !            39: SECOND"
        !            40: string(19) "FIRST=
        !            41: =20
        !            42: SECON=
        !            43: D"
        !            44: string(18) "FIRST=20=20
        !            45: SECOND"
        !            46: string(24) "FIRST=
        !            47: =20=
        !            48: =20
        !            49: SECON=
        !            50: D"

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>