-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix GH-8157: post_max_size evaluates .user.ini too late in php-fpm #19333
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
This introduces new SAPI callback that runs before post read
Wanted to try it out and in the process realized that for me, modifying both And then as I was fiddling with it (commenting out lines etc), I suddenly had things in a weird state where some workers were accepting the uploads and others were not. And I realized that... maybe in all the cases where people are testing this, they're simply not seeing their config changes take effect because of |
(and this I think reveals a separate issue, @bukka: if |
@dzuelke I just checked the test if it really fails without the patch and the test really fails (no post max exceeding error). And with the fix it works (it errors due to getting over the post max size limit). So I think the fix works and as you can see it also recreates the issue. From what I see in the code, the point of the caching is not to parse INI config on each request which seems expected. I would have to test it to see. But do you see any issue after this patch applied? |
That's what I'm trying to say - it works fine for me without the patch applied, so I am wondering where the issue lies. I'll keep digging. FWIW I am testing with a "positive" check ("does the |
I just played with the test and again it fails without the patch and works with the test. The changes are not commited because it should metter and requires more memory (would have to extend the tester to support custom ini):
I should note that tester is using From what I see there is an issue with not applying the .user.ini and this fixes it which I can see from the tests above. |
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.
How does this work? All implementations of pre_request_init
just return SUCCESS?
@@ -458,6 +458,10 @@ SAPI_API void sapi_activate(void) | |||
SG(request_parse_body_context).throw_exceptions = false; | |||
memset(&SG(request_parse_body_context).options_cache, 0, sizeof(SG(request_parse_body_context).options_cache)); | |||
|
|||
if (sapi_module.pre_request_init) { | |||
sapi_module.pre_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.
Return value not checked?
Yeah looks like failing .user.ini is not terminating failure (just reflecting previous behaviour). If this should change, it should be probably through a different PR. |
It seemed a bit strange to me too but guess that maybe it was on purpose not to fail request because .user.ini parsing fails I thought. Not sure but might potential break things if it changes so I didn't touch it. |
Ahhhh, I was testing with A May I suggest adding a second test without a |
@dzuelke You are free to create a separate PR adding such tests but it has nothing to do with this bug fix. :) The point here is to really test that the issue got fixed which this does. Or do you see some other issue with the mentioned cases that would change after this fix? |
No, it was just to guard against future regressions ;) |
@@ -337,6 +339,7 @@ END_EXTERN_C() | |||
0, /* phpinfo_as_text; */ \ | |||
NULL, /* ini_entries; */ \ | |||
NULL, /* additional_functions */ \ | |||
NULL /* input_filter_init */ | |||
NULL, /* input_filter_init */ \ | |||
NULL /* activate_user_config */ |
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.
Nit:
NULL /* activate_user_config */ | |
NULL /* pre_request_init */ |
This introduces new SAPI callback that runs before post read