8000 Use cURL over file_get_content when available by Starfox64 · Pull Request #3500 · dompdf/dompdf · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Use cURL over file_get_content when available #3500

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Starfox64
Copy link
Contributor

Dompdf will always use file_get_content as long as allow_url_fopen is 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:

I think usage of cURL should have priority over file_get_contents as 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.

@bsweeney
Copy link
Member
bsweeney commented Jul 24, 2024

follow_location does not work under certain circumstances

Under what circumstances? Follow location is disabled by default. When enabled, under what circumstances does it not work with file_get_contents?

Helpers::encodeURI still corrupts some characters (@ symbol)

Do you have a sample URL?

@bsweeney bsweeney added this to the 3.0.1 milestone Jul 24, 2024
@bsweeney
Copy link
Member

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.

@bsweeney bsweeney modified the milestones: 3.0.1, 3.0.2 Dec 2, 2024
@bsweeney
Copy link
Member
bsweeney commented May 25, 2025

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. file_get_content handling could be problematic, but I don't have a valid Google Storage URL I can use for testing.

@Starfox64
Copy link
Contributor Author

I'll give this another try in the coming weeks to verify, currently unavailable.

@bsweeney
Copy link
Member
bsweeney commented Jun 1, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0