Bug #68532 [NEW]: convert.base64-encode omits padding bytes

From: Date: Mon, 01 Dec 2014 12:42:03 +0000
Subject: Bug #68532 [NEW]: convert.base64-encode omits padding bytes
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-188871@lists.php.net to get a copy of this message
From: blaesius at krumedia dot de Operating system: Debian 8 PHP version: 5.6.3 Package: Streams related Bug Type: Bug Bug description:convert.base64-encode omits padding bytes 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 bug report at https://bugs.php.net/bug.php?id=68532&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68532&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68532&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68532&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=68532&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=68532&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=68532&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=68532&r=needscript Try newer version: https://bugs.php.net/fix.php?id=68532&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=68532&r=support Expected behavior: https://bugs.php.net/fix.php?id=68532&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=68532&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=68532&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=68532&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68532&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=68532&r=dst IIS Stability: https://bugs.php.net/fix.php?id=68532&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=68532&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=68532&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=68532&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=68532&r=mysqlcfg

« previous php.bugs (#188871) next »