MailMimeParser 0.4

Base64DecodeStreamFilter extends php_user_filter

Unfortunately neither the built-in base64 decoder in PHP, nor the HHVM implementation for their ConvertFilter seem to handle large streams correctly. There appears to be no provision for data coming in when they're not split on 4 byte-chunks (each 4-byte chunk of base-64 encoded data translates to 3-bytes of unencoded data).

encoded data).

Tags
author

Zaahid Bateson

Table of Contents

STREAM_FILTER_NAME  = 'mmp-convert.base64-decode'
Name used when registering with stream_filter_register.
$leftover  : string
filter()  : int
Filter implementation converts encoding before returning PSFS_PASS_ON.
getRawBytes()  : array<string|int, string>
Returns an array of complete lines (including line endings) from the passed $bucket object.

Constants

STREAM_FILTER_NAME

Name used when registering with stream_filter_register.

public mixed STREAM_FILTER_NAME = 'mmp-convert.base64-decode'

Properties

Methods

filter()

Filter implementation converts encoding before returning PSFS_PASS_ON.

public filter(resource $in, resource $out, int &$consumed, bool $closing) : int
Parameters
$in : resource
$out : resource
$consumed : int
$closing : bool
Return values
int

getRawBytes()

Returns an array of complete lines (including line endings) from the passed $bucket object.

private getRawBytes(object $bucket) : array<string|int, string>

If the last line on $bucket is incomplete, it's assigned to $this->leftover and prepended to the first element of the first line in the next call to getLines.

Parameters
$bucket : object
Return values
array<string|int, string>

Search results