craftcms / craftcms/cms

Upgrade from 3.0 to 3.1 not working with Custom Logger

Open
#3,703 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
3.6k
Forks
705
Avg merge
1d 5h
Merged PRs (30d)
134

Description

Description

I have a custom logging function in .../project/config/app.php. This function in the components array uses Craft::createObject(...) to add a custom Log Target. Craft::createObject(...) uses craft\helpers\App::mailerConfig() somewhere.

In .../project/vendor/craftcms/cms/src/helpers/App.php, function mailerConfig, the $settings variable is null, which triggers $settings = static::mailSettings();. $settings itself is then not null but the variables $settings->transportType, $settings->transportSettings are null. And MailerHelper::createTransportAdapter has no null check.

Beside that error, is there a way to check if the system is in an upgrade process? Otherwise I cannot check the Mailer Config is empty and my upgrade process fails. I manually deactivate the custom logger target, but then I also have to upgrade manually on the production system.

Additional info
  • Craft version: 3.1.3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in vendor/craftcms/cms/src/helpers/App.php at mailerConfig and trace the Craft::createObject(...) path from the custom logger configuration in project/config/app.php. Inspect MailerHelper::createTransportAdapter and the upgrade lifecycle to determine how null mail settings should be handled or detected. Done means the custom logger no longer blocks the 3.0-to-3.1 upgrade when mailer settings are empty, with coverage for that path.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.