Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initialize address as null. Previously if an email with no recipient … #516

Merged
merged 1 commit into from
Aug 20, 2021

Conversation

bobmurdoch
Copy link
Contributor

Right now if an email with undisclosed recipients is received, calling getAddress will throw an Error 'Typed property Ddeboer\Imap\Message\EmailAddress::$address must not be accessed before initialization' as initialization of the address property only occurs when a non-null hostname is passed in.

(Some more info on this error
https://madewithlove.com/blog/software-engineering/typed-property-must-not-be-accessed-before-initialization/ )

Change is to initialize address as null before the hostname check. Thanks

…is loaded, the hostname is empty and the address property is not initialized. Prior to this change, when then trying to access the address via getAddress a 'Typed property must not be accessed before initialization' would be thrown
@codecov
Copy link

codecov bot commented Aug 20, 2021

Codecov Report

Merging #516 (c9ad373) into master (857edb2) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master     #516   +/-   ##
=========================================
  Coverage     95.63%   95.64%           
  Complexity      355      355           
=========================================
  Files            45       45           
  Lines           848      849    +1     
=========================================
+ Hits            811      812    +1     
  Misses           37       37           
Impacted Files Coverage Δ
src/Message/EmailAddress.php 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 857edb2...c9ad373. Read the comment docs.

@Slamdunk Slamdunk added the bug label Aug 20, 2021
@Slamdunk Slamdunk merged commit 45eb491 into ddeboer:master Aug 20, 2021
@Slamdunk
Copy link
Collaborator

Thank you

saintsloth pushed a commit to saintsloth/imap that referenced this pull request Oct 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants