On servers where fopen_url option is disabled, aggregating JS causes errors with WYSIWYG editor similar to:

Warning: file_get_contents(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in drupal_build_js_cache() (line 4940 of /includes/common.inc).
Warning: file_get_contents(http://localhost/sites/default/files/js/wysiwyg/wysiwyg_tinymce_VxxRIlca...): failed to open stream: no suitable wrapper could be found in drupal_build_js_cache() (line 4940 of //includes/common.inc).

It is possible to resolve this by either turning on the fopen_url option or setting this file not to aggregate / cache. I've added a patch which allows JS aggregation to still work with fopen_url turned off.

The issue seems to be caused by line 351 in wysiwyg.module, generating an absolute URL (with HTTP stream-wrapper).

            drupal_add_js(file_create_url($uri), $default_library_options);

changing that line simply to

            drupal_add_js($uri, $default_library_options);

Seems to fix the issue as the file_get_contents($path) call in drupal_build_js_cache() properly accepts the "public://" stream wrapper.

CommentFileSizeAuthor
wysiwyg.patch808 byteslemming
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

TwoD’s picture

Status: Active » Closed (duplicate)

Thanks for the patch but this has already been fixed in the -dev version. #1802394: Warning: file_get_contents from 7.x-2.1 to 7.x-2.2

TwoD’s picture

Issue summary: View changes

Adjusted the wording slightly for grammar.