1

Whenever I add any content on my website, I get this warning.

Warning: in_array() expects parameter 2 to be array, string given in _drupal_http_use_proxy() (line 1100 of /var/www/html/includes/common.inc)

I am not sure why it does that, and how do I solve it? Can anyone help?

PS: I don't know what tags should I use for this question.

EDIT1: Executing

dpm(variable_get('proxy_exceptions'));

enter image description here

2 Answers 2

3

This is the code for _drupal_http_use_proxy

function _drupal_http_use_proxy($host) {
  $proxy_exceptions = variable_get('proxy_exceptions', array('localhost', '127.0.0.1'));
  return !in_array(strtolower($host), $proxy_exceptions, TRUE);
}

The status message warns that $proxy_exceptions is not an array.

You can configure this setting on your settings.php file, this way:

$conf['proxy_exceptions'] = array('127.0.0.1', 'localhost');

Have you changed this variable to anything other than an array?

 $conf['proxy_exceptions'] = '127.0.0.1'; // For example

Maybe there is a contributed module which do this...

Try to insert a dpm on $proxy_exceptions or execute this on /devel/php to show the value of this variable:

dpm(variable_get('proxy_exceptions'));

If you want to reset this variable:

variable_set('proxy_exceptions', array());

or

variable_del('proxy_exceptions');
12
  • Hi, Thanks for answering. I have checked my settings.php file and I have this data but it is commented by default and I haven't changed anything. Here is the data # $conf['proxy_server'] = ''; # $conf['proxy_port'] = 8080; # $conf['proxy_username'] = ''; # $conf['proxy_password'] = ''; # $conf['proxy_user_agent'] = ''; # $conf['proxy_exceptions'] = array('127.0.0.1', 'localhost'); Commented May 9, 2014 at 14:28
  • Have you checked what is the value of this expression: dpm(variable_get('proxy_exceptions')); on /devel/php
    – jorgetutor
    Commented May 10, 2014 at 7:55
  • I have installed the devel module now, I don't know how and where to execute it? Can you guide me please? Commented May 12, 2014 at 9:07
  • 1
    Then reset the variable: variable_set('proxy_exceptions', array());
    – jorgetutor
    Commented May 12, 2014 at 16:41
  • 1
    The proxy_exceptions variable was corrupted on some point. You have reset this to a proper array() value.
    – jorgetutor
    Commented May 14, 2014 at 9:35
1

I couldn't solve why I used to get the error messages, but I hid the errors and warnings for the everyone except admin using Disable Messages module. It's quite good, all I had to do is install the module, and change the permissions according to roles.

I will update my answer if I found the way to solve this warning.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.