Repository navigation
Zend: Remove returns after zend_error_noreturn - #23285
Conversation
|
To be honest, I think we could just get rid of those reimplementation functions? N.B.: |
Ok, well, I don't know anything about FPM. I was just trying to fix a superficial problem. But if these functions should be removed, can you open a separate PR and I will drop the commit from my PR? |
Just did so. Also looking at other instances of this, and I think I found a similar "fun" comment related to these functions already... #if !defined(HAVE_SETENV) || !defined(HAVE_UNSETENV)
/* if cgi, or fastcgi and not found in fcgi env
check the regular environment
this leaks, but it's only cgi anyway, we'll fix
it for 5.0
*/
len = name_len + (value ? strlen(value) : 0) + sizeof("=") + 2;
buf = (char *) malloc(len);
if (buf == NULL) {
return getenv(name);
}
#endif |
These are functions that have existed since Unix V7. Windows doesn't have them, but we don't support FPM on Windows (and in ext/standard, there are other ways to emulate it that don't involve WTF comments). clearenv is kept as this was from a rejected POSIX proposal that only some systems implement (Linux, FreeBSD, some 90s Unices). Also removes the WTF comment incidentally; see GH-23285.
8be44f3 to
485a5c8
Compare
TimWolla
left a comment
There was a problem hiding this comment.
Several of the functions “now” had a constant return value of SUCCESS. Should we voidify them at the same time? This will likely allow removing (dead) checks in callers as well.
I'm also noting they also wrongly use int instead of zend_result as the return type, which would implicitly be cleaned up when voidifying them.
Should I do it in this PR or in a separate one? |
|
For me adjusting the return type logically belongs to this change / PR. It's already removing return statements, and adjusting the return type is just the final consequence. |
I changed it to |
Ah, I didn't realize that the signature needs to match a function pointer signature. That's unfortunate, but |
|
Actually, looking at how |
|
I think these kinds of changes are pointless on its own, unless you also take into account what Tim says wrt voidifying. Right now the value of the PR (except for the zend_result type) is still questionable. |
495bc0a to
7321e39
Compare
|
Makes sense. Both of you have very good points. I have moved the error inside |
TimWolla
left a comment
There was a problem hiding this comment.
LGTM except for Changelog remark, thanks.
This might have been an issue on older MSVC but presumably it's no longer the case as zend_mark_internal_attribute has not had a return for the past 4 years and nobody complained.
20a2343 to
21eb8b0
Compare
Taken from the article https://helgesver.re/articles/hidden-comments-in-php-src