ext/standard/mail: Various refactorings (part 1)#20782
Merged
Girgias merged 9 commits intophp:masterfrom Dec 27, 2025
Merged
Conversation
ndossche
requested changes
Dec 26, 2025
| @@ -518,10 +518,10 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c | |||
| } | |||
|
|
|||
| if (PG(mail_x_header)) { | |||
| const char *tmp = zend_get_executed_filename(); | |||
| const zend_string *tmp = zend_get_executed_filename_ex(); | |||
Member
There was a problem hiding this comment.
This is not equivalent because zend_get_executed_filename cannot return NULL while zend_get_executed_filename_ex can
Member
There was a problem hiding this comment.
Please revert this change, the extra complexity does not seem worth it. I doubt you're gonna feel the strlen() call here anyway. Furthermore I don't like to duplicate some of that logic here.
49fc148 to
b68179a
Compare
ndossche
requested changes
Dec 26, 2025
| @@ -518,10 +518,10 @@ PHPAPI bool php_mail(const char *to, const char *subject, const char *message, c | |||
| } | |||
|
|
|||
| if (PG(mail_x_header)) { | |||
| const char *tmp = zend_get_executed_filename(); | |||
| const zend_string *tmp = zend_get_executed_filename_ex(); | |||
Member
There was a problem hiding this comment.
Please revert this change, the extra complexity does not seem worth it. I doubt you're gonna feel the strlen() call here anyway. Furthermore I don't like to duplicate some of that logic here.
In preparation for php_mail() refactoring
Fix incorrect return type Use zend_string macros
The branching logic is already defined in the function
Change paremeter type to be zend_string* rather than assuming the zval IS_STRING Use zend_string macros Add const qualifier
b68179a to
2290aef
Compare
ndossche
approved these changes
Dec 27, 2025
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.
Commits should be reviewed in order
Part 1 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.