Use cURL over file_get_content when available - #3500
Conversation
Under what circumstances? Follow location is disabled by default. When enabled, under what circumstances does it not work with
Do you have a sample URL? |
|
In my use case images point to some API that redirects to the actual image in Google Cloud Storage. It's a signed temporary URL so any change will cause the signature to be voided, in this case
|
|
Thanks for the info. The change seems fine on first look. I'll let you know if I have any feedback once I have a chance to mull it over. |
|
I don't think the issue is with Helpers::encodeURI. When I run that sample URL through the method it returns without any changes (in the latest release). Using the URL in an image src attribute shows correct handling internally as far as I can tell. |
|
I'll give this another try in the coming weeks to verify, currently unavailable. |
|
FYI while I'd like to confirm the issues with the in-built logic, I'll move forward with the change regardless since curl is generally more robust. |
|
I did a test with the path+querystring from that sample URL using an online request inspector and it showed exactly what was expected. Possible that we've addressed whatever issues you were previously experiencing. If you find otherwise let me know. |
Dompdf will always use
file_get_contentas long asallow_url_fopenis enabled (which it is by default).This unfortunately means that cURL will essentially never be used and we are stuck with file_get_contents and it's limitations:
follow_locationdoes not work under certain circumstancesI think usage of cURL should have priority over
file_get_contentsas it's more robust.I considered making this configurable but since this method is static and doesn't have access to configuration, this becomes difficult.