Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following @wujku issue #246 here I'm proposing a change to
Message\Headers
to resolve it.Since the very first tag in 2013, header validation and specifically EmailAddresses and Date header validation are done at
Message\Headers
construction, meaning that if any error occurs in any header, no header at all can be queried.An invalid Date would make this code raising the Exception:
While I would expect it to be thrown only when needed:
This PR leaves the
decode
in the Header construction, so all headers will always be UTF-8, but moves the logic to theMessage\AbstractMessage
API.Is this a BC break?
Yes and No.
Yes because this code would behave differently:
No because the previous example is not a public API usage (i.e. interfaces signatures), so it wouldn't be an incompatible API change. In fact the following code would behave the same:
We could in theory make the change fully backward compatible, but we would need to overwrite a lot of
ArrayIterator
functions:current
,getArrayCopy
,next
,offsetGet
,get
,seek
,serialize
etc. Too complex, doesn't worth the effort.Moreover, I like the change to the
Message\Headers
contents because the user would be able to choose to query the raw header through theMessage\Headers
instance, or the parsed header through theMessage
API.At the time of writing, I'm tagging this to the 1.1 milestone expected to be released on 2017-11-06.
If we decide this to be a complete BC break, I'll move it to the 2.0 milestone, expected to be released on 2018-03-05 (at least 6 months after the previous major release to gather other major suggestions).
@ddeboer @wujku what do you think?