When a HTTP request returns an empty header value drupal_http_request() throws the following notice:

Notice: Undefined offset: 1 in drupal_http_request() (line 986 of ...\includes\common.inc).

The function should better check for empty values beforehand.

See http://php.net/manual/en/function.list.php

Comments

mahaprasad’s picture

For this function first argument $url value is not set, that's why this Notice is throws.

function drupal_http_request($url, array $options = array())

For more information check http://api.drupal.org/api/drupal/includes!common.inc/function/drupal_http_request/7

frank ralf’s picture

Thanks for your quick reply, but I'm not sure that's the reason for this notice. I will check again to provide more details.

klausson’s picture

I'm actually getting the same error message when using drupal_http_request to retrieve an image from a remote site when the header gets returned empty. code is 200, so I know I have a valid file and it actually gets written to my local site accurately. Yet, when I check for content-type and content-length, they are both empty (as is the rest of the header array).

Version: 7.19 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.