#18744 closed enhancement (invalid)
Check if web hosting allows fopen
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | General | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description
I had encounter error on many web hosting when using the get_theme_data() function which uses get_file_data()in functions.php in wp-includes folder.
Many web hosting has disabled allow_url_fopen,
was thinking if it is possible to add some checks to get_file_data() to prevent fopen errors in this situation, by returning empty array if allow_url_fopen is disabled.
Thanks!
Attachments (1)
Change History (5)
denzel_chia — 20 months ago
comment:1
SergeyBiryukov — 20 months ago
- Keywords has-patch added
comment:2
denzel_chia — 20 months ago
Yes, I am using get_theme_data() to get the theme information on locally installed theme, but was met with fopen error, because allow_url_fopen, if set to Off in php.ini will disallow fopen function completely. All web hosting has different settings, so was thinking of adding this check so that perhaps, it can fail silently.
I wasn't using get_file_data() to get any external site file.
Thanks!
comment:3
denzel_chia — 20 months ago
- Resolution set to invalid
- Status changed from new to closed
Sorry, my mistake, should not have used get_stylesheet_uri() in get_theme_data(), there is http in url and that becomes "external file".
Please ignore this ticket.
Thanks!
comment:4
SergeyBiryukov — 20 months ago
- Milestone Awaiting Review deleted

Shouldn't get_file_data() be used for local files only?