php-imap icon indicating copy to clipboard operation
php-imap copied to clipboard

Resolves #582 - Default to returning all parts, add allow_single_parts op…

Open mrhewitt opened this issue 6 months ago • 0 comments

I implemented a fix here for Issue 582 and related (issues of bodies not being decoded etc) as follows:

  1. Added new config option, "allow_single_parts", bool defaulting to true

  2. Altered Structure::parsePart to alter "fix" commited in issue #455 to rather be:

if ( count($parts) > 1 || $config->get("options")['allow_single_parts'] ) {

This will now always return parts if there are multiple but allows it to optionally also return if only a single part is found.

I believe the default here should be true (always return recursive part even if only one part is found in a multipart block) as this how it operated for years before, and it would seem in most cases looking at all issues raised since this commit was pulled in this is valid behavior (otherwise we get undecoded parts).

For edge cases such as experienced by @michalkortas there is the possiblity of setting "allow_single_parts" to false in thier configuration, thus still achieving what they set out to in the PR but in a way that does not affect most users.

mrhewitt avatar May 30 '25 13:05 mrhewitt