Skip to content

Constify char* arguments of APIs #5676

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

Closed
wants to merge 21 commits into from
Closed

Conversation

twose
Copy link
Member

@twose twose commented Jun 7, 2020

No description provided.

@@ -52,13 +52,12 @@
#define ZEND_LOGO_DATA_URI "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAPoAAAAvCAYAAADKH9ehAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAEWJJREFUeNrsXQl0VNUZvjNJSAgEAxHCGsNitSBFxB1l0boUW1pp3VAUrKLWKgUPUlEB13K0Yq1alaXWuh5EadWK1F0s1gJaoaCgQDRKBBJDVhKSzPR+zPfg5vLevCUzmZnwvnP+k8ybN3fevfff73/vBAJTHxc+khL5kr6T1ODk5nAgTRTWloghFVtEg/zfh2PkSvq9pJGSKiX9SdKittbJoD/PSYkrJD0vKeB4IsNNotfuUtHk/CM+IvijpF9KGiDpGEkLJZ3lC7qPeKKTpD9IWiDpUOfWPCi61ZeLvD2VIhTwp9QlTjK5NsIXdB/xxHmSpvD/OucWPSAyQw2+LfeG1SbXVra1Tqb785xUaNdMel0g7Iu5V1zPv6dJqpD0kKR/+ILuI55o8oeg1bFT0kWSOkraQxK+oPvw0TZR3ZY758foyQXf//ZxUFh0Q/GEfNf9gHkaJ6m7pHJJSyTt9tnXhxtBR2EGlnHCMbZMaHuHzX19JZ0u6VRJh0k6hM+BpMjnklZIelPSNhff3V5StkNlEWBMFm+3LcC+BW3GuZP2GvfmiEiCCMUzxZIKRGSt9zeML/fdGAW9JB3O8c6SlMZ+b5f0qaQiF7EpnieXY1auvZfG7zhSUk8RSS428F7M5xfsh1eAV/vxOzoq16sklZBqbdpo5H2qDPRQXoP3Ki0+20FSFyrZUgt+Rt/7KH2vZb8/t/iMG2Sy/0dI6sbvgHG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W/m/PwRhQBwZFkT2vXzDbTtLMZCyfP1155bbfDrpjKZoYH41bO+d97jmEgMPVxFMF0iHESIkiNtDhKuwV058cw0dBZNP+lFsSU/6VWf0E4P/x+IF2eJnokr4uW/2jAKPYjjRb7Cxef70c3qsCl0im1Gj/Uu2eF6sWo0rUiTQq7zS+pYjywnXYwcyOZfI4mKgHj9N2ttHqbRfSlQXhjw5XXy4S7ZbzOovkxVRsphHp8ia3HlyleZS1zHcvoVrdjuNFdEe7edGHzSbpSria/WZ3+cxYV5DCx/4w7FUfyfTW0WO+i7x2YrzKUXZFw/sut+OxJDGkHUxEZPwgCquQcIgxZR9oXekDQk8FF60bqwocupaIoEz6EmaC3C+0Ro6Wgp4eb2tpPJqN+4xXFXQ3TfUfCc5PDNnLZDpLIV1NADKyjZa87mHgmWX57bYdIfIY3pdCGf43xQUXI62kBn3fZxi4SPC8crIjDQ4yzFAaz/XcPJn7xf03VRzIB5Z7qCbBzPQi5jga2E9bCD+ELug8ficEZCk/Cmj8Ro3aLtLxDR1/QffhIHNRTUZCf+S5G7SJBp2b7G31B9+EjcVAFEInZQ2LU7jiN1zf4gu7DR+KwTvkfO9bGx6BNnEQ8XXmN5cT3fEH34SNxwN4A9dgknIEwyWNbeRTwV7WYHBVwFQfbwKb7vOUjiYAiKVT1PczXqCLD/n5UbuLcNxTKoCgExSFNmsFCHI6iJBQFnUbqqbWPHyFceDAOrC/oPpIN+FVaVLrNUa6dLPbvoEQdO4pd1OUylBVkCutsOkqosbNvwcE6qL6g+0hG3MY4ejots1pT3kE4P9QDdfuLKeDfHswD6gu6j2TF2yQcLoqEGurre9EdP1QTfmxJRdn0NlrvD+jmY69Egz+UQvxfgAEALJ4EcRDa/toAAAAASUVORK5CYII="

BEGIN_EXTERN_C()
PHPAPI zend_string *php_info_html_esc(char *string);
PHPAPI void php_info_html_esc_write(char *string, int str_len);
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 can not find any implementation of php_info_html_esc_write

Copy link
Member

Choose a reason for hiding this comment

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

The definition of php_info_html_esc_write() has been removed in PHP 5.4, so the declaration can be removed as well.

while (ss) {
space = strchr(ss, '+');
if (space) {
*space = '\0';
Copy link
Member Author

Choose a reason for hiding this comment

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

Notice: the original implementation used a hack way so I made some changes here

@@ -260,12 +260,11 @@ PHPAPI int php_session_register_serializer(const char *name,
zend_string *(*encode)(PS_SERIALIZER_ENCODE_ARGS),
int (*decode)(PS_SERIALIZER_DECODE_ARGS));

PHPAPI void php_session_set_id(char *id);
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 can not find any implementation of php_session_set_id

}

#else
Copy link
Member Author

Choose a reason for hiding this comment

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

Notice: missing function implementations here, so I made some changes

@nikic
Copy link
Member

nikic commented Jun 7, 2020

Build failure on AppVeyor:

ext\standard\mail.c(504): error C2220: the following warning is treated as an error
ext\standard\mail.c(504): warning C4090: 'function': different 'const' qualifiers
ext\standard\mail.c(504): warning C4090: 'function': different 'const' qualifiers
ext\standard\mail.c(504): warning C4090: 'function': different 'const' qualifiers

@twose
Copy link
Member Author

twose commented Jun 7, 2020

Build failure on AppVeyor:

ext\standard\mail.c(504): error C2220: the following warning is treated as an error
ext\standard\mail.c(504): warning C4090: 'function': different 'const' qualifiers
ext\standard\mail.c(504): warning C4090: 'function': different 'const' qualifiers
ext\standard\mail.c(504): warning C4090: 'function': different 'const' qualifiers

The deeper code is a bit more complicated so I just convert these pointers to char* now

@cmb69
Copy link
Member

cmb69 commented Jun 7, 2020

The deeper code is a bit more complicated so I just convert these pointers to char* now

I think the following would do:

 ext/standard/mail.c | 2 +-
 win32/sendmail.c    | 8 ++++----
 win32/sendmail.h    | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index 61454a4930..b13acc82b7 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -501,7 +501,7 @@ PHPAPI int php_mail(const char *to, const char *subject, const char *message, co
 	if (!sendmail_path) {
 #ifdef PHP_WIN32
 		/* handle old style win smtp sending */
-		if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, hdr, (char *) subject, (char *) to, (char *) message, NULL, NULL, NULL) == FAILURE) {
+		if (TSendMail(INI_STR("SMTP"), &tsm_err, &tsm_errmsg, hdr, subject, to, message, NULL, NULL, NULL) == FAILURE) {
 			if (tsm_errmsg) {
 				php_error_docref(NULL, E_WARNING, "%s", tsm_errmsg);
 				efree(tsm_errmsg);
diff --git a/win32/sendmail.c b/win32/sendmail.c
index 281c343533..67253a3b79 100644
--- a/win32/sendmail.c
+++ b/win32/sendmail.c
@@ -177,7 +177,7 @@ static zend_string *php_win32_mail_trim_header(char *header)
 //  See SendText() for additional args!
 //********************************************************************/
 PHPAPI int TSendMail(char *host, int *error, char **error_message,
-			  char *headers, char *Subject, char *mailTo, char *data,
+			  char *headers, const char *Subject, const char *mailTo, const char *data,
 			  char *mailCc, char *mailBcc, char *mailRPath)
 {
 	int ret;
@@ -352,7 +352,7 @@ PHPAPI char *GetSMErrorText(int index)
 // Author/Date:  jcar 20/9/96
 // History:
 //*******************************************************************/
-static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data,
+static int SendText(char *RPath, const char *Subject, const char *mailTo, char *mailCc, char *mailBcc, const char *data,
 			 char *headers, char *headers_lc, char **error_message)
 {
 	int res;
@@ -633,7 +633,7 @@ static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char
 	return (SUCCESS);
 }
 
-static int addToHeader(char **header_buffer, const char *specifier, char *string)
+static int addToHeader(char **header_buffer, const char *specifier, const char *string)
 {
 	*header_buffer = erealloc(*header_buffer, strlen(*header_buffer) + strlen(specifier) + strlen(string) + 1);
 	sprintf(*header_buffer + strlen(*header_buffer), specifier, string);
@@ -651,7 +651,7 @@ static int addToHeader(char **header_buffer, const char *specifier, char *string
 // Author/Date:  jcar 20/9/96
 // History:
 //********************************************************************/
-static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders)
+static int PostHeader(char *RPath, const char *Subject, const char *mailTo, char *xheaders)
 {
 	/* Print message header according to RFC 822 */
 	/* Return-path, Received, Date, From, Subject, Sender, To, cc */
diff --git a/win32/sendmail.h b/win32/sendmail.h
index bb502cb7dd..a35851acf8 100644
--- a/win32/sendmail.h
+++ b/win32/sendmail.h
@@ -33,15 +33,15 @@
 
 
 PHPAPI int TSendMail(char *smtpaddr, int *returnerror, char **error_message,
-			  char *RPath, char *Subject, char *mailTo, char *data,
+			  char *RPath, const char *Subject, const char *mailTo, const char *data,
 			  char *mailCc, char *mailBcc, char *mailRPath);
 PHPAPI void TSMClose(void);
-static int SendText(char *RPath, char *Subject, char *mailTo, char *mailCc, char *mailBcc, char *data,
+static int SendText(char *RPath, const char *Subject, const char *mailTo, char *mailCc, char *mailBcc, const char *data,
 			 char *headers, char *headers_lc, char **error_message);
 PHPAPI char *GetSMErrorText(int index);
 
 static int MailConnect();
-static int PostHeader(char *RPath, char *Subject, char *mailTo, char *xheaders);
+static int PostHeader(char *RPath, const char *Subject, const char *mailTo, char *xheaders);
 static int Post(LPCSTR msg);
 static int Ack(char **server_response);
 static unsigned long GetAddr(LPSTR szHost);

@twose
Copy link
Member Author

twose commented Jun 7, 2020

@cmb69 Thank you, I am a bit lazy 🤪

Copy link
Member

@nikic nikic left a comment

Choose a reason for hiding this comment

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

Nice work!

{
timelib_time *parsed_time;
timelib_error_container *error = NULL;
int error2;
zend_long retval;

parsed_time = timelib_strtotime(string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
parsed_time = timelib_strtotime((char *) string, strlen(string), &error, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper);
Copy link
Member

Choose a reason for hiding this comment

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

Could you please also submit a PR to https://github.com/derickr/timelib, so we can drop these const casts in the future?

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 did not change it because I was worried whether this modification will affect other projects
but I will try to submit a PR soon

Copy link
Member Author

Choose a reason for hiding this comment

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

Added TODO comment

Copy link
Member Author

Choose a reason for hiding this comment

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

@twose twose force-pushed the constify-2020 branch 2 times, most recently from 3594d84 to 3cdfe9c Compare June 7, 2020 19:22
@twose twose force-pushed the constify-2020 branch 2 times, most recently from 3dbddc3 to df2a329 Compare June 8, 2020 05:41
@twose twose force-pushed the constify-2020 branch 2 times, most recently from dcab466 to 406d58d Compare June 8, 2020 06:44
@twose
Copy link
Member Author

twose commented Jun 8, 2020

compilation passed

Copy link
Member

@nikic nikic left a comment

Choose a reason for hiding this comment

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

Wow, this has really blown up!

@@ -805,7 +805,7 @@ PHP_METHOD(Phar, webPhar)

sapi_header_op(SAPI_HEADER_REPLACE, &ctr);
sapi_send_headers();
efree(ctr.line);
efree((void *) ctr.line);
Copy link
Member

Choose a reason for hiding this comment

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

The ctr.line related changes look a bit dubious to me. Do we gain anything by making it const char?

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 only receives a read-only string in most cases

size_t len = 0;

ZEND_PARSE_PARAMETERS_START(0, 1)
Z_PARAM_OPTIONAL
Z_PARAM_STRING(ctr.line, len)
Z_PARAM_STRING(line, len)
Copy link
Member

Choose a reason for hiding this comment

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

This makes me wonder why the Z_PARAM_STRING target is char ** and not const char **. Maybe we should change that as well (but separately -- it may have larger fallout).

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 couldn't agree more, that's what I thought a long time ago
but if we change it, it may break many PECL extensions. and we can't reflect it is read-only when we use Z_PARAM_STR

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, I'm not sure what to do about this one. With the old zend_parse_parameters API, it was possible to use both const char and char, because it simply wasn't validated. With Z_PARAM_STRING it is, and the wrong one has been originally used :(

For the zend_string APIs, I don't think "const" concept makes a lot of sense, because semantics are determined by copy-on-write. Effectively zend_string is "always" const (apart from refcount changes).

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 think it may be appropriate to fix it in PHP8 because we already have a lot of BC breaks 🤪...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants