-
-
Notifications
You must be signed in to change notification settings - Fork 157
[WIP] Decode MIME-encoded subject and addresses #37
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
Conversation
|
I also see that pull request #34 attempts to do this for subjects, but |
|
I can see a few potential issues here. What happens if the "getSubject" function is called multiple times? It looks like the imap_mime_header_decode function gets run on the value of $this->subject, saved over that value, and then in future attempts the already decoded script will be run through imap_mime_header_decode again. At the very least this is inefficient, but at worst I can see it causing errors on subsequent requests to getSubject. I've made some alterations to the test suite, so you should give that another try. If you have issues I'll help you out. |
|
Merged in your latest changes and ran composer update. Seemed to get further along with booting up the VM, then this: I'm running The test suite is working just fine for you? I'm wondering if there's a difference in our environments that's causing this. |
From my reading of the imap_mime_header_decode() docs, it looks like it won't decode an element that isn't encoded. I take that to mean that it also won't try to decode an element that has already been decoded, an assumption that my tests have confirmed. Multiple calls to getSubject return the same thing. No weird double-decoding. Regarding efficiency, imap_mime_header_decode() is a pretty quick function. I called getSubject dozens of times on the same message, measuring the call time for each. The longest any of the calls took was only 0.00011920928955078 seconds. |
|
See #146 |
|
I think can be closed because #147 merged to master |
Haven't added tests for this yet (for the life of me, I can't get the Fetch test suite running), but in my real-world experience, these methods for decoding a message's subject and addresses have worked flawlessly.
If you can help me get the test suite running, I'm happy to write tests for these.