Skip to content

Conversation

@Girgias
Copy link
Member

@Girgias Girgias commented Dec 27, 2025

Follow-up from #20781

Commits should be reviewed in order.

The main objective here is to get rid of some of the globals as it makes it, IMHO, unintuitive how the code flows.

This allows moving out from MailConnect() the logic to determine the local host name and remove a global
@Girgias Girgias marked this pull request as ready for review December 27, 2025 16:13
@Girgias Girgias requested a review from ndossche December 27, 2025 16:13
Copy link
Member

@ndossche ndossche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't do most of these changes to be honest. They take time to review and double check and code motion is not very easy to reason about.

win32/sendmail.c Outdated
#define PHP_WIN32_MAIL_DOT_REPLACE "\n.."

static int SendText(const char *RPath, const char *Subject, const char *mailTo, const char *data,
static int SendText(_In_ const char *host, const char *RPath, const char *Subject, const char *mailTo, const char *data,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did you add a SAL here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems this is how you'd add the __attribute__((nonnull(1))); from GCC but for Windows/MSVC, if there is another way happy to take it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would need to look it up, but I don't think that's true? But it's been a while since I saw SAL.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I got there by trying to navigate MS's docs... but if you find the correct thing than I'm happy to change it.

}
}

/* attempt to connect with mail host */
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this commit is not very useful code motion that complicates things to be honest. If it works why change it? It's not like this is a maintainability problem.
I also don't want to diverge too much from the original wSendmail source code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot find how the wSendmail code would even look like as everything is dead links and google has become trash and is unhelpful. So I can't even compare how much we have diverged already and if this not just "we maintain this now"

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, although I wish reality was different, I feel like we already maintain too many parts ourselves.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I very much agree with this, also having the whole mail functionality chucked away in a small external extension would also solve this problem of not needing to maintain this ourself :/

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can think of two points in the past where we deviated from the original code:

  1. Around 5.3 when we made use of pcre over ereg as ext/pcre became always available

  2. When I many years ago fixed it to work owing IPv6 and intranet domains (specifically the HELO part)

So we have already stepped over that edge a long time ago, either way I have no opinion on the matter just some historical context

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants