-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix #16929: curl_getinfo($ch, CURLINFO_CONTENT_TYPE) returns false when Content-Type header is not set #16997
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
…to false - Ensures consistent behavior when Content-Type is missing
@MarcusXavierr I believe that returning
Returning |
@ondrejcech yep, it seems it should return NULL when someone calls But should this function call return NULL just to this option? Because all string responses from curl_getinfo seem to have Lines 2663 to 2670 in ba8e3e1
Edit: I think adding a new case on the switch is the cleanest solution 🤔 |
I think returning I agree, that adding a new case on the switch is the cleanest for my problem. |
Looks like this is already pretty inconsistent. In some cases |
OK, I understand. Can we at least make |
@cmb69 that's the point. from what I've read on the code, if the request was successful, but the Lines 2496 to 2504 in ba8e3e1
|
I had a closer look: as is, Thinking about that further, the different behavior regarding returning The only real inconsistency I see is that the |
This PR addresses an inconsistency in how
curl_getinfo($ch, CURLINFO_CONTENT_TYPE)
handles cases where the Content-Type header is missing or empty. Reported on issue #16929Previously, curl_getinfo could return
false
when using the specific CURLINFO_CONTENT_TYPE flag, butNULL
when accessing the content_type key from the associative array returned by curl_getinfo($ch).Now, it'll return
NULL
in both situations.