When an invalid url is passed into imagecache_external_fetch(), a notice "undefined index 'host'" is thrown, because it is assumed that parse_url returns an array with that key. Adding a check that checks if the key is there (and not empty) fixes this. If the check fails, the URL is invalid (you must have a host) so we can return FALSE.

A patch is attached.

Comments

marty2081’s picture

StatusFileSize
new539 bytes

Corrected the patch.

BarisW’s picture

Status: Active » Fixed

Thanks a lot for the patch. I fixed it in another way, but added the commit on your name.

<?php
  if (!($host = parse_url($url, PHP_URL_HOST))) {
    return FALSE;
  }
?>

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.