Line #94 in devel_generate_image function contains assignment to an unused variable.

    $images[$extension][$min_resolution][$max_resolution][$destination] = $destination;

$images is never used

I have attached a patch to remove the line.

Thanks,
nandiki

CommentFileSizeAuthor
remove-unused-line.patch574 bytesnandiki

Comments

salvis’s picture

Have you checked the context where it was introduced? Was it used at the time. Maybe it was/is a debugging tool?

pcambra’s picture

Status: Active » Needs review

I was thinking this just today when dealing with devel images provider.

I tracked back this code to #687788: Support file and image fields in D7's devel_generate and this commit http://drupalcode.org/project/devel.git/commitdiff/d7d9a33508ed6e889514e...

$images is definitely used as there's this code
$file->fid = array_rand($images[$extension][$min_resolution][$max_resolution]);

But that's in an else, inside this if there's no further use.
if (!isset($images[$extension][$min_resolution][$max_resolution]) || count($images[$extension][$min_resolution][$max_resolution]) <= DEVEL_GENERATE_IMAGE_MAX) {

In any case, it's invoked as static
static $images = array();

salvis’s picture

Status: Needs review » Fixed

Thanks for tracking this down, pcambra.

Committed to D8 and D7, thanks for the patch, nandiki.

Status: Fixed » Closed (fixed)

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