Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#18744 closed enhancement (invalid)

Check if web hosting allows fopen

Reported by: denzel_chia Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: has-patch
Focuses: Cc:


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.


Attachments (1)

functions.diff (625 bytes) - added by denzel_chia 9 years ago.

Download all attachments as: .zip

Change History (5)

#1 @SergeyBiryukov
9 years ago

  • Keywords has-patch added

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

#2 @denzel_chia
9 years 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.


#3 @denzel_chia
9 years 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.


#4 @SergeyBiryukov
9 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.