|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75910 convert.base64-encode omits padding bytes
Submitted: 2018-02-02 22:09 UTC Modified: 2018-07-08 18:01 UTC
Avg. Score:5.0 ± 0.0
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:0 (0.0%)
From: me at levisflorian dot name Assigned: pollita (profile)
Status: Verified Package: Streams related
PHP Version: 7.2.2 OS: macOS 10.13.3 (via brew)
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2018-02-02 22:09 UTC] me at levisflorian dot name
When using temp stream, filter convert.base64-encode omits padding bytes.
Actually on php 7.2.1 (instead of 7.2.2 selected above) - multiple php versions installed with

Found a similar bug on old php version #68532 (

Test script:
Please find test script (based on #68532) here:

Expected result:
encode - low-level - memory = dGVzdA==
decode - low-level - memory = test
encode - low-level - temp = dGVzdA==
decode - low-level - temp = test

Actual result:
encode - low-level - memory = dGVzdA==
decode - low-level - memory = test
encode - low-level - temp = dGVz
decode - low-level - temp = test


filter-flag-on-eof (last revision 2018-09-20 05:07 UTC by tenzzor at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-02 22:19 UTC] me at levisflorian dot name
-Package: Filter related +Package: Streams related
 [2018-02-02 22:19 UTC] me at levisflorian dot name
Change "package" from "Filter related" to "Streams related"
 [2018-07-08 18:01 UTC]
-Status: Open +Status: Verified -Assigned To: +Assigned To: pollita
 [2018-07-08 18:01 UTC]
Confirmed: <>.

Apparently, this regression has been introduced by commit
0a45e8f[1].  Sara, could you please have a look at this?

[1] <>
 [2018-09-20 05:13 UTC] tenzzor at gmail dot com
Hi guys. Found the same issue.
I added a patch, which I think might be more generic solution. 
In case of filtered stream, while loops until eof on stream. However, when we successfully read from stream and reached EOF on stream, flags are still set to NORMAL, next iteration won't happen, because there is EOF and filter is never notified of EOF.

This does not happen on php://memory stream right now, because on read it returns all data up to EOF, but does not mark stream as EOF. Then on next read it figures there is no more data in buffer, marks stream as eof and returns 0 read.
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Sun Feb 17 18:01:25 2019 UTC