xref: /PHP-7.4/ext/standard/tests/file/bug68532.phpt (revision 86f18755)
1--TEST--
2Bug #68532: convert.base64-encode omits padding bytes
3--FILE--
4<?php
5$testString = 'test';
6$stream = fopen('php://memory','r+');
7fwrite($stream, $testString);
8rewind($stream);
9$filter = stream_filter_append($stream, 'convert.base64-encode');
10echo "memoryStream = " . stream_get_contents($stream).PHP_EOL;
11
12
13$fileStream = fopen(__DIR__ . '/base64test.txt','w+');
14fwrite($fileStream , $testString);
15rewind($fileStream );
16$filter = stream_filter_append($fileStream , 'convert.base64-encode');
17echo "fileStream = " . stream_get_contents($fileStream ).PHP_EOL;
18?>
19--CLEAN--
20<?php
21unlink(__DIR__ . '/base64test.txt');
22?>
23--EXPECT--
24memoryStream = dGVzdA==
25fileStream = dGVzdA==
26