Skip to content

Conversation

@Girgias
Copy link
Member

@Girgias Girgias commented Dec 28, 2025

Follow-up from #20782

Commits should be reviewed in order

Part 2 of various refactoring relating to php_mail(), the main objective is to get rid of various strlen() recomputations when we already know the length of the strings, and various clean-ups.

There will be a part 3 when #20789 and this gets merged to propagate zend_strings to the win32 TSendMail() function to remove some more strlen() calls for known lengths.

@Girgias Girgias force-pushed the mail-refactor-part-2 branch from 8799e62 to f4a47fd Compare December 28, 2025 00:58
@Girgias Girgias requested a review from ndossche December 28, 2025 00:59
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'm not reviewing this further. I don't like all the code motion; I don't think this improves readability enough to justify the complexity and risks of refactoring.


PHPAPI zend_string *php_mail_build_headers(const HashTable *headers);
PHPAPI extern bool php_mail(const char *to, const char *subject, const char *message, const char *headers, const zend_string *extra_cmd);
PHPAPI extern bool php_mail(const char *to, const char *subject, const zend_string *message, const char *headers, const zend_string *extra_cmd);
Copy link
Member

Choose a reason for hiding this comment

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

Note that this is less flexible than having a char pointer, as third party extensions are now also forced to wrap their string in a zend_string first.

}

while(*hdr) {
while (hdr < end) {
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what the implications are of allowing NULs now. I suppose that won't work properly anyway?

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.

2 participants