Repository navigation
Fix grabUrlsFromLastEmail for HTML entities and single-part emails - #139
Merged
Merged
Conversation
wazum
force-pushed
the
bugfix/137-138-grab-urls
branch
from
October 1, 2026 09:27
f64f2d9 to
a22b4f3
Compare
Collaborator
|
@wazum Please resolve the conflicts |
mail-mime-parser returns null for a missing text or HTML part, which used to be passed to preg_match_all() and raised a deprecation notice. The null guard landed with captbaritone#130; this test keeps it from regressing. Resolves: captbaritone#138
The URL regex runs over raw HTML markup, so an href written as "?id=1&token=abc" came back with the literal "&" and the second query parameter was lost when the URL was opened. Resolves: captbaritone#137
wazum
force-pushed
the
bugfix/137-138-grab-urls
branch
from
October 1, 2026 17:15
a22b4f3 to
45df715
Compare
Contributor
Author
|
@Jamesking56 Rebased onto current |
Jamesking56
approved these changes
Oct 2, 2026
Collaborator
|
Thanks @wazum |
|
Released in 4.1.0. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves: #137, #138
Rebased onto current
master(after #130, #136 and #140). There are two commits, one per issue.#137:
&in URLs from the HTML partThe URL regex runs over raw HTML markup, so
href="…?id=1&token=abc"came back with a literal&. The application then never receivedtoken.grabUrlsFromEmail()now entity-decodes URLs from the HTML part, which fixes bothgrabUrlsFromLastEmail()andgrabUrlsFromNthEmail(). URLs from the text part are left untouched, because entities have no meaning in plain text. The order and number of returned URLs are unchanged, since callers index into this array.Tests:
testGrabUrlsFromLastEmailDecodesHtmlEntities. It fails on currentmasterwith…?id=1&token=abc.test_grab_urls_from_html_email_with_multiple_query_parametersagainst a real MailCatcher.#138: null passed to
preg_match_all()The null guard itself already reached
masterwith #130, when the URL code moved intograbUrlsFromEmail(). This commit adds the missing regression test,testGrabUrlsFromSinglePartEmailsRaisesNoDeprecation. It covers a plain-text-only and an HTML-only email, and turns notices raised fromsrc/into failures. Notices from dependencies are ignored, because mail-mime-parser 3.0.1 raises its own deprecation under--prefer-lowest.Both suites pass locally on PHP 8.5 with the latest dependencies and on PHP 8.3 with
--prefer-lowest(109 tests).