Problem/Motivation
Thank you Adam for having time to have a big and quick progress on this module.
Testing after each release ...
Only reporting this issue after updating to Symfony Mailer 1.0.0-alpha7
Steps to reproduce
Given that the Symfony Mailer module was installed in a Drupal 9.3.x site
And the Symfony Mailer Back-compatibility module was enabled too
And the Error messages to display was sat to "All messages, with backtrace information"
When navigating to "/admin/config/system/mailer/import"
Then the following notice will show up 3 times
Notice: Undefined index: import in Drupal\symfony_mailer\Processor\EmailBuilderManager->getImportInfo() (line 103 of modules/contrib/symfony_mailer/src/Processor/EmailBuilderManager.php).
Drupal\symfony_mailer\Processor\EmailBuilderManager->getImportInfo() (Line: 59)
Drupal\symfony_mailer\Controller\SymfonyMailerController->importStatus()
call_user_func_array(Array, Array) (Line: 123)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 564)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 58)
Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 48)
Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 51)
Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 708)
Drupal\Core\DrupalKernel->handle(Object) (Line: 19)
Proposed resolution
Have a check for the import index.
Remaining tasks
- File the issue
- Fix patch/MR
- Testing
- Review
- Comment
- Release
User interface changes
API changes
Data model changes
Comments
Comment #2
rajab natshahComment #4
rajab natshahComment #5
adamps commentedThanks for the testing and bug report. My enthusiasm for this project has been boosted by seeing how many sites are using the module already.
I don't see the warning you report. I think this patch shouldn't be needed because there is code in
Drupal\symfony_mailer\Annotation\EmailBuilderto initialise$import = '';.Please could you try clearing caches and see if that fixes it?
Comment #6
joshahubbers commentedI can confirm that I also needed this patch.
I updated a site from Swift mailer to Symphony mailer, following https://www.drupal.org/docs/contributed-modules/symfony-mailer-0/getting....
On the first "import configuration", there was nothing to import.
On the second "import configuration", the error occured.
Drupal 9.3.9
Comment #7
adamps commentedDid you both try clearing caches?
Please could you try and get some debug output with code something like this:
Comment #8
joshahubbers commentedIk did clear the cache multiple times. That normally solves most of Drupal's problems ;-).
I moved away from this module because after testing, i stumbled upon the unability to mail attachments with webform. So unfortunately I cannot provide more info at this moment. Maybe I will revisit this when attachments are supported. I see a lot of activity in that issue.
Comment #9
steveg. commentedAfter updating to the latest version of Symfony mailer 1.0.0-alpha7 and applying the patch. I don't get any error's and I've tested my mailing and works like it should.
Comment #10
adamps commentedThanks for the updates. The problem I have is that I can't reproduce the error, and I can't see why any change is needed, as explained in #5. In #7 I asked if someone could provide some extra debugging. Any help with this would be welcome.
Comment #11
adamps commentedHa and now I hit it myself😃.
I added a new patch that I prefer because it goes to the source of the problem by fixing the missing array entry (and any other possible future missing entry). Previous patch just worked around the missing entry.
I would appreciate any testing.
Comment #12
adamps commentedComment #14
rajab natshahPatch in #11 is the better fix from
symfony_mailer_bcdirectlyThanks Adam, it is the right fix.
Only in case custom modules had a BC functions to import for custom plugins
A throw message with try-catch could be nicer on the import in case of empty imports.
Updated the Steps to reproduce with
Given that the Symfony Mailer module was installed in a Drupal 9.3.x site
And the Symfony Mailer Back-compatibility module was enabled too
And the Error messages to display was sat to
"All messages, with backtrace information"Comment #15
rajab natshah