Skip to content

Read options.fetch_body and options.fetch_flags from the config - #628

Open
csemazharul wants to merge 1 commit into
Webklex:masterfrom
csemazharul:fix/query-honours-fetch-body-and-flags-config
Open

Read options.fetch_body and options.fetch_flags from the config#628
csemazharul wants to merge 1 commit into
Webklex:masterfrom
csemazharul:fix/query-honours-fetch-body-and-flags-config

Conversation

@csemazharul

Copy link
Copy Markdown

Fixes #620.

src/config/imap.php documents both options:

'fetch_body'  => true,
'fetch_flags' => true,

but Query::__construct() never reads them. It picks up options.sequence, options.fetch, options.fetch_order, date_format and options.soft_fail, while $fetch_body and $fetch_flags stay at their hardcoded true:

protected bool $fetch_body = true;
protected bool $fetch_flags = true;

So setting either in the ClientManager config has no effect, and the only way to turn one off is to chain setFetchBody(false) / setFetchFlags(false) on every query.

Change

Two lines in the constructor, next to the options it already reads. true stays the default, so behaviour is unchanged for anyone who has not set them.

$this->fetch_body = $config->get('options.fetch_body', true);
$this->fetch_flags = $config->get('options.fetch_flags', true);

Test

tests/issues/Issue620Test.php covers both directions — config values honoured, and the defaults still true. It fails on master and passes with the change.

tests/issues before: Tests: 24, Assertions: 58, Errors: 1, Failures: 6
tests/issues after: Tests: 24, Assertions: 59, Errors: 1, Failures: 5

The remaining error and five failures are pre-existing on master and unrelated (Issue355, 379, 383, 410, 420, 511). The root-level unit tests pass in both cases. Note the full suite stops early on a live-mailbox test when LIVE_MAILBOX is unset, so I ran the directories separately.

src/config/imap.php documents both options, but Query never read them:
the properties were hardcoded to true, so the only way to turn either off
was to chain setFetchBody(false) / setFetchFlags(false) on every query.

Take them in the constructor alongside the other options it already
reads, keeping true as the default so nothing changes for anyone who has
not set them.

Fixes Webklex#620
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Config options options.fetch_body and options.fetch_flags are silently ignored

1 participant