API page: http://api.drupal.org/comment/reply/22488

Calling the function from a site with a webserver level password will return a warning:
"file_get_contents(http://****/sites/all/libraries/jquery.hoverIntent/jquery.hoverIntent.js): failed to open stream: HTTP request failed! HTTP/1.1 401 Authorization Required in _locale_parse_js_file() (regel 1472 van /hum/userdata/****/drupal-7.12/includes/locale.inc)."

I guess the function should figure out if $filepath is from the same domain as the called page and get the file contents by a server file location if so... that would avoid this without breaking compatibility with data coming from other resources.

Comments

coert’s picture

Component: documentation » system.module
Priority: Normal » Minor
coert’s picture

Component: system.module » locale.module
coert’s picture

Status: Active » Closed (works as designed)

Figured I should pass my own locations to this function, so it's solved, my bad.

finex’s picture

@Coert: I'm experiencing this same issue, it has been triggered by wysiwyg module. Should be opened a bug report against wysiwyg? Thanks

mvc’s picture

Project: Drupal core » Wysiwyg
Version: 7.x-dev » 7.x-2.x-dev
Component: locale.module » Code
Priority: Minor » Normal
Status: Closed (works as designed) » Active

i'm also seeing this with wysiwyg, but not with any other file_get_contents() calls in core. it would be nice to work around this.

twod’s picture

Version: 7.x-2.x-dev » 7.x-2.2
Status: Active » Closed (duplicate)

This happens because I accidentally made Wysiwyg add a local JavaScript file using an absolute URL, which made it impossible to aggregate or parse for translation when the server has set allow_url_fopen=0.
This is already fixed in 7.x-2.x-dev and will be part of the next release, see #1802394: Warning: file_get_contents from 7.x-2.1 to 7.x-2.2.