-
Notifications
You must be signed in to change notification settings - Fork 8k
ext/standard/mail: Various refactorings (part 1) #20782
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
base: master
Are you sure you want to change the base?
Conversation
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 Use for loop
| PHP_RSHUTDOWN_FUNCTION(user_filters); | ||
| PHP_RSHUTDOWN_FUNCTION(browscap); | ||
|
|
||
| /* Left for BC (not binary safe!) */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this comment still accurate now?
|
|
||
| if (PG(mail_x_header)) { | ||
| const char *tmp = zend_get_executed_filename(); | ||
| const zend_string *tmp = zend_get_executed_filename_ex(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not equivalent because zend_get_executed_filename cannot return NULL while zend_get_executed_filename_ex can
| } | ||
|
|
||
|
|
||
| #define MAIL_RET(val) \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this code motion is important/useful.
| while (len < value->len) { | ||
| if (*(value->val+len) == '\r') { | ||
| if (*(value->val+len+1) != '\n') { | ||
| for (size_t len = 0; len < ZSTR_LEN(value); len++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change is wrong.
Now you always increment len, even if the "continue" is hit. So the following code block:
len += 3;
continue;will now increment by 4 instead of 3.
| . _php_error_log() now has a formal return type of zend_result. | ||
| . _php_error_log() now accepts zend_string* values instead of char*. | ||
| . _php_error_log_ex() has been removed. | ||
| . php_mail()'s extra_cmd parameter is now a zend_string*. |
There was a problem hiding this comment.
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 this change accomplishes concretely
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.