-
Notifications
You must be signed in to change notification settings - Fork 7.9k
main/php_ini.c: remove dead code #4512
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
Conversation
f41df19
to
93741a5
Compare
cc @nikic I believe is the right ping here for the review. :) Merging dead code to PHP 7.4 is from my point of view still ok. Less diffs between 7.4 and 8.0 is very smart if we can do that. |
It might make more sense to factor out this repetitive code-pattern into a function (append_ini_path or something). |
@nikic exactly my idea. have some static method inside that same source file to avoid the repeative code. |
ideally, I'd move those large platform-specific |
86067f3
to
f4ecfac
Compare
... added something |
main/php_ini.c
Outdated
return ""; | ||
} | ||
|
||
size = GetEnvironmentVariableA(envname, phprc_path, size); |
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 think the size
parameter should be min(size, MAXPATHLEN)
, not to overflow phprc_path
.
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.
@nikic fix this or leave as is?
Appveyor:
|
moved too much, fixed 62b362e |
do you want me to rebase this to lowest branch? or maintainers can handle that? and in that case, what is that branch? |
main/php_ini.c
Outdated
return ""; | ||
} | ||
|
||
env_location = phprc_path; |
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.
You are returning a reference to stack memory here. The pointer will be invalidated when the function returns.
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.
suggestions? always strdup value, return NULL if no value? playing with is_allocated variable seems overkill, as this code path is invoked only on init (not request init)?
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.
One option would be to not return anything from get_env_location
, but to pass the buffer into the function.
What's the status of this RFC? Is it still relevant? Should it target PHP-8.0? |
150d268
to
201a4b2
Compare
Only 3 years, 4 months to merge! thanks :) |
main/php_ini.c:492 always initializes
php_ini_search_path
being empty:That change was introduced in acb1e07 by @dstogov