-
Notifications
You must be signed in to change notification settings - Fork 135
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
Message bodies are always NULL #240
Comments
I'm having the same issue. Is there a planned fix for this? |
I did a pull request with the fixed code, but It looks like it failed some build somewhere because of PSR formatting ... but that's not in the current master. It's just a bunch of spaces added really. I don't understand at all what's going on there. I did the pull request ... so we'll see where that goes. |
I have applied akopciuch solution for my local code, but the bug stil here. Did you made some another change? |
No. It was a single line change on line 384 of the file IncomingMessage.php
becomes
|
PLEASE ADD THIS TO THE COMPOSER. |
Feature request or bug
Bug
If a bug, what did you expect to happen?
Get the body of an email using
$body = $message->message->text;
If a bug, what happened?
$message->message->text is NULL, but the body clearly exists in the object(s) when debugging (var_dump, print_r, etc.)
If a bug, list steps to reproduce bugs.
Try and access the "text" property on a message.
If a bug, did you do these steps?
[] Download and use the latest stable version
Yes
[] See if the issue has already been reported
Yes, there are similar issues, but they seem focused on base64 decoding.
[] Debug
Yes
If a feature request, what do you want to be added or changed?
If a feature request, is this feature already in a pull request?
If a feature request, do you know anyone who can help?
Side notes(Read then del this chunk)
It seems to come down to a problem in the getBody() method on the IncomingMessage class.
IncomingMessage.php:384
Using property_exists on an object of type SubtypeBody which extends Section will never detect a property named "structure". The property on the parent class Section is actually $_structure. "structure" is a special property availble using the __get() method which property_exists will not detect.
This means every message will simply continue to the next section without ever setting a value to $obj->plain. Which in turn means that is never decoded and assigned to $obj->text. The message body properties are simply NULL ... always.
I tried changing it to look for property_exists("_structure"), but the same result occurred. I think it has something to do with the fact the object is actually an extension of Section. I'm not sure when class properties will be detected as existing when inherited from a parent. Especially without having explicit __construct() methods.
I modified my local copy of the code to be like this below, and I instantly could access the email message bodies again.
I think that should work, because it looks like the verification is checking to make sue it is actually an object type, and the structure property exists ... which the result of __get() will reflect. Feel free to patch it that way, or if there is a better way to write that code that I'm just not understanding.
The text was updated successfully, but these errors were encountered: