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

An empty file in the attachment generates false instead of the whole Message #211

Open
lkorczewski opened this issue Mar 12, 2018 · 0 comments

Comments

@lkorczewski
Copy link

Replication

Trying to retrieve an email containing an attachment with an empty text file.

Result

false instead of object of class Message

When analyzed more closely, the false value arose from an exception:

protected 'message' => string 'Notice: Undefined property: stdClass::$bytes' (length=44)
private 'string' (Exception) => string '' (length=0)
protected 'code' => int 0
protected 'file' => string '/SOME_PATH/vendor/tedivm/fetch/src/Fetch/Attachment.php' (length=85)
protected 'line' => int 101

Notes

There is also one thing, while the declaration below:

/**
 * Returns the requested email or false if it is not found.
 *
 * @param  int          $uid
 * @return Message|bool
 */
public function getMessageByUid($uid)

says true -- it's Message or bool.

The declaration of getOrderedMessages does not:

/**
 * Returns the emails in the current mailbox as an array of ImapMessage objects
 * ordered by some ordering
 *
 * @see    http://php.net/manual/en/function.imap-sort.php
 * @param  int       $orderBy
 * @param  bool      $reverse
 * @param  int       $limit
 * @return Message[]
 */
public function getOrderedMessages($orderBy, $reverse, $limit)

beacause you may end up with an array including falses if there were any errors and that's misleading.

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

No branches or pull requests

1 participant