Skip to content

Making into disposition string to lowercase to fix the comparision issue - #566

Closed
ambrous wants to merge 1 commit into
barbushin:masterfrom
ambrous:master
Closed

Making into disposition string to lowercase to fix the comparision issue#566
ambrous wants to merge 1 commit into
barbushin:masterfrom
ambrous:master

Conversation

@ambrous

@ambrous ambrous commented Dec 11, 2020

Copy link
Copy Markdown

Hi!

I faced an issue that in some cases field disposition comes in upper case and due to that comparisions of 'attachment' == $partStructure->disposition faild. It seems that it happens with outlook attachments.

Also, I'm not sure that is was a good idea to add an additional param to function of downloadAttachment, but I suppose it looks a bit more clear.

@Sebbo94BY
Sebbo94BY changed the base branch from master to develop February 23, 2021 15:08
@Sebbo94BY

Copy link
Copy Markdown
Collaborator

@ambrous this change seems to break something. Please rebase and solve this issue. Otherwise I'll close this pull request in the future.

@ambrous

ambrous commented Feb 24, 2021

Copy link
Copy Markdown
Author

@Sebi94nbg , I've rebased. However, I don't know how to recheck again by codeclimate.

@Sebbo94BY

Copy link
Copy Markdown
Collaborator

@bapcltd-marv I'm kinda unsure about this change. Does it make sense to you? Would you merge it?

@ambrous

ambrous commented Sep 9, 2021

Copy link
Copy Markdown
Author

I think it is useful fix as sometime attachments are lost due to the low case of the disposition.

@Sebbo94BY
Sebbo94BY changed the base branch from develop to master December 28, 2021 00:33

@Sebbo94BY Sebbo94BY left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, forgot to publish my review. 😞

Comment thread src/PhpImap/Mailbox.php
* @return IncomingMailAttachment $attachment
*/
public function downloadAttachment(DataPartInfo $dataInfo, array $params, object $partStructure, bool $emlOrigin = false): IncomingMailAttachment
public function downloadAttachment(DataPartInfo $dataInfo, array $params, object $partStructure, bool $emlOrigin = false, bool $dispositionAttachment = false): IncomingMailAttachment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are adding a new argument here and set it by default to false, but it seems like as it's never used, so it's always false. Isn't it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, please see the whole changed function not only my changes.

Comment thread src/PhpImap/Mailbox.php
public function downloadAttachment(DataPartInfo $dataInfo, array $params, object $partStructure, bool $emlOrigin = false, bool $dispositionAttachment = false): IncomingMailAttachment
{
if ('RFC822' == $partStructure->subtype && isset($partStructure->disposition) && 'attachment' == $partStructure->disposition) {
if ('RFC822' == $partStructure->subtype && isset($partStructure->disposition) && $dispositionAttachment) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still not sure, if this is a good replacement. I think, this will break (also) something.

Before: string comparisation
After: boolean comparisation

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function skipped attachments in some emails due to case sensitive comparison.
I've just put almost the same comparison (but now it is not case sensitive) in one place and then use the boolean replacement of it, kind of some refactoring)

@Sebbo94BY

Copy link
Copy Markdown
Collaborator

Superseeded by #750. This issue should be solved now.

@Sebbo94BY Sebbo94BY closed this May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants