mtymek/MtMail

Error when enabled DefaultHeaders twice

Closed this issue · 10 comments

I did not know that module comes with the composer plugin DefaultHeaders enabled. So, I re-enabled this plugin again. And, I got this exception:

Zend\Mail\Exception\DomainException

Cannot grab address list from header of type "ArrayIterator"; not an AbstractAddressList implementation

/var/www/energyworks/vendor/zendframework/zendframework/library/Zend/Mail/Message.php:480

What should we do with this?

We could do two things:

  • DefaultHeaders doesn't need to be enabled by default. Instead I can move it do example local config file
  • enabling plugin twice doesn't make any sense, so array_unique should fix your error.

Do you want to take care of that?

enabling plugin twice doesn't make any sense

Yes, I also agree.

Do you want to take care of that?

As you said, I will use array_unique.

OK, looking forward for PR then!

I thought about using array_unique for a while but what if somebody enables it with default-header or something like that?

Sorry, I don't understand your concern. Can you explain?

I am saying that default-header is the same as DefaultHeader and because of this. This feature will be removed in Zend Framework 3.

In that array_unique won't work.

Seems only way to fix it now it to canonicalize plugin names - see my PR.