There is an infinite recursion bug with revision 1.209.2.44, DRUPAL-5 (branch: 1.209.2). The $node->images[preview] comes empty in certain cases to the image_display() function, seemingly because the image is the same size as the original. The image_display() function sends Drupal into infinite recursion because the conditionals see an empty $node->images[$label] and attempt to generate derivs. Proper fix would be to make sure that $node->images['preview'] is never empty. Temporary patch is provided, by changing image_display to check for an empty $node->image['preview'] and make it equal to $node->image['_original'] if it is empty.
adding:
$node->images['preview'] = empty($node->images['preview']) ? $node->images['_original'] : $node->images['preview'];
Simple fix patch is attached, but I would fix it by making sure that images['preview'] is not empty easier on in the process.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | image_171080.patch | 591 bytes | drewish |
| image-d5-recursion.patch | 769 bytes | sami_k |
Comments
Comment #1
sami_k commentedMight want to avoid all infinite recursion in this function by using:
That way if any fields come empty to this function it won't go into infinite recursion. Behavior was observed at time of creation of a node only.
Comment #2
drewish commentedi think this would actually be a better way of doing it. can you test it out for me?
Comment #3
drewish commentedIt fixes the previews when the original image is smaller than the preview size so I'm committing it to HEAD and DRUPAL-5.
Comment #4
sami_k commentedYour patch causes a problem which has the module trying to copy nothing to files/{filename}.preview.png:
[file] => public_html/sites/all/modules/image/image.module
[line] => 949
[function] => file_move
[args] => Array
(
[0] =>
[1] => {filename}.preview.png
)
Comment #5
sami_k commentedRelated with: http://drupal.org/node/160671
Comment #6
sami_k commentedIn addition the module says that it regenerated derivs which it does not do without the latest patch. The functionality seems to be fine, but the logic of the module gets screwed up along the way throwing out unnecessary messages.
Comment #7
drewish commentedi think you're right but the issue you point out is addressed over on: http://drupal.org/node/160671
Comment #8
drewish commentedin #6 i'm not sure if you're referring to the patch on comment #2 or #160671. if you're referring to #160671 please follow up over there.
Comment #9
sami_k commented#6 I am talking about 5.x head. The patch you posted above causes that problem.
Comment #10
drewish commented#160671 was committed to HEAD and should have cleared this up.
Comment #11
(not verified) commented