Bug #68532 [Opn->Csd]: convert.base64-encode omits padding bytes

From: Date: Fri, 12 Dec 2014 16:04:08 +0000
Subject: Bug #68532 [Opn->Csd]: convert.base64-encode omits padding bytes
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189040@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=68532&edit=1 ID: 68532 Updated by: jpauli@php.net Reported by: blaesius at krumedia dot de Summary: convert.base64-encode omits padding bytes -Status: Open +Status: Closed Type: Bug Package: Streams related Operating System: Debian 8 PHP Version: 5.6.3 Block user comment: N Private report: N New Comment: Automatic comment on behalf of php@mcq8.be Revision: http://git.php.net/?p=php-src.git;a=commit;h=86f18755362b594c519ccde37c3b3f98158b591e Log: Fix bug #68532: convert.base64-encode omits padding bytes Previous Comments: ------------------------------------------------------------------------ [2014-12-01 12:42:01] blaesius at krumedia dot de Description: ------------ When using a memory stream and the read filter "convert.base64-encode" the last character is missing from the output if the base64 conversion needs padding bytes. This doesn't happen when using a file. Test script: --------------- $testString = 'test'; $stream = fopen('php://memory','r+'); fwrite($stream, $testString); rewind($stream); $filter = stream_filter_append($stream, 'convert.base64-encode'); echo "memoryStream = " . stream_get_contents($stream).PHP_EOL; $fileStream = fopen(__DIR__.'/base64test.txt','w+'); fwrite($fileStream , $testString); rewind($fileStream ); $filter = stream_filter_append($fileStream , 'convert.base64-encode'); echo "fileStream = " . stream_get_contents($fileStream ).PHP_EOL; Expected result: ---------------- memoryStream = dGVzdA== fileStream = dGVzdA== Actual result: -------------- memoryStream = dGVz fileStream = dGVzdA== ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=68532&edit=1

« previous php.bugs (#189040) next »