-
-
Notifications
You must be signed in to change notification settings - Fork 252
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
Bad message number #204
Comments
Btw this can return a caught exception using the following code added to //
// within class, also needs
// use Ddeboer\Imap\Exception\PartDoesNotExist;
//
private function partDoesNotExistSetHandleAndExecute(callable $c) {
set_error_handler(
function ($nr, $error) {
throw new PartDoesNotExist(
$this->messageNumber,
$error
);
}
);
$result = $c();
restore_error_handler();
return $result;
} Exception Class <?php
namespace Ddeboer\Imap\Exception;
class PartDoesNotExist extends Exception
{
public function __construct($number, $error)
{
parent::__construct(
sprintf(
'Part %s does not exist: %s',
$number,
$error
)
);
}
} |
This is part of #146 but method signature from issue should be (using exception error catcher here) public function getRAW() {
return $this->partDoesNotExistSetHandleAndExecute(function() {
return imap_fetchbody(
$this->stream,
$this->messageNumber,
"",
\FT_PEEK
);
});
} |
This library uses only message uid: if you deleted an old message, the id of newer messages remain the same, so it is ok to have missing numbers. You need to use Note that this functionality will be present in the next release, look at #146 |
This isn't a duplicate, I've just tried setting the
|
Also that merge should try using null or "" as the third param, so that we can still peek at messages in 4th param 😢 |
I'm sorry we can't help you if you have custom source code.
It does, take a look at the merge commit: 6ae87c9 |
The error I'm reporting is not from custom code, it's from an existing method in this library. I'm not asking you to fix, I'm recording a bug that exists in this library, even with the I've also been recording details in-case I get busy or don't have time to fix, so the next person that comes along can fix, and not have to duplicate my work. As for the PR, I see the additional commit, thanks for adding. I couldn't know it existed though could I? It's been 28 minutes since it was committed and not part of the PR. This is not an attack, or a criticism, please stop treating it as such. |
The method you pasted: public function getRAW() {
// [...]
} Isn't part of this library. If you think it is, please post the github link of the file that contains these lines.
Each feedback is welcome. At the same time we can fix only issues that are reproducible: without a data set that reproduces the error we can't alter the code because we can't prove the fix would be valid.
Unfortunately not: as a Collaborator I can push commits to a PR only during the merge, and it is not very noticeable in Github this step 😞 |
I don't need you to fix though, and the error still exists. The error is not in the The code I posted allows the PHP Warning to be converted into an exception (following convention from elsewhere in this lib). This will also help with a test-case for the existing method to get a specific part from a message for text and HTML (that exception wouldn't be elsewhere if nobody encountered a missing message). I'm not saying it has to be in the lib (which is why it's in an issue, not a PR). Issues are not all created to ask you to solve. They document edge cases, and by closing this one, it makes it harder to see it's still a current issue with the lib as-is in a release or master branch (apparently the develop branch too). It's one of those weird edge cases and could even be related to the version of IMAP PHP extension supports ( One way to validly remove this would be to remove the coupling on |
As far as I can see, this library will always be just a wrapper to the I am sorry but we can't put efforts in issues that cannot be reproduced: having them hanging here forever wouldn't help much in my humble opinion. |
Again, I'm not asking you to fix it. (It's been an unreported issue since 2015, nobody fixed that). The reason I mentioned separating was not to ask you to do it, it was to add a written record of a way to solve. This isn't about solving, it's about documenting what-is. |
I attached a debugger to get the following message numbers from
src/Mailbox.php#L57
public function getMessages(SearchExpression $search = null)
It looks like the email host (dreamhost) cannot be trusted to return ID's that return (seems 141 is missing and 182 is there, which means it's probably skipping a message).
What (sh|c)ould be the resolution?
The text was updated successfully, but these errors were encountered: