I think there's a logic gap in the imagecache_external_generate_path function which does:

if extension exists in parsed external URL then
    if extension is jpg/png/jpeg/gif then
         OK, use that extension
    else
        UNIMPLEMENTED CASE
else
   OK, use default extension

So if the source image has an extension like, say, php, because it's a dynamically created image at source, the logic results in NO extension being added to the filename.

However, interestingly, when the file is fetched it is created with an extension. This results in the image being fetched, processed and cached every time - effectively diabling the cache.

A fix would be simply

if extension exists in parsed external URL && extension is jpg/png/jpeg/gif the
     OK, use that extension
else
   OK, use default extension

Comments

artfulrobot created an issue.