Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
Fresh installation of Drupal 7.16 running on php 5.4. Going to configuration -> image styles -> large -> edit. Override and then attempt to revert back fails with message:
Notice: Undefined index: image_style in image_style_revert_form_submit() (line 345 of {path removed}\modules\image\image.admin.inc).
Notice: Undefined index: image_style in image_style_revert_form_submit() (line 346 of {path removed}\modules\image\image.admin.inc).
Resulting in image style not reverting back to its original state.
Proposed resolution
In file image.admin.inc line 329.
function image_style_revert_form($form, $form_state, $style)
adding missing & in $form_state resolves error and reverts back image style
function image_style_revert_form($form, &$form_state, $style)
Comment | File | Size | Author |
---|---|---|---|
#2 | undefined_index-1833028-2.patch | 530 bytes | michaelmol |
Comments
Comment #1
Anonymous (not verified) CreditAttribution: Anonymous commentedNot an issue for D8.
Comment #2
michaelmol CreditAttribution: michaelmol commentedAttached patch with proposed code change.
Comment #3
michaelmol CreditAttribution: michaelmol commentedComment #4
minida28 CreditAttribution: minida28 commentedIt hurt both my local and production drupal sites, but the proposed solution works really well, thanks !
In my local devel:
Drupal 7.17 on XAMPP 1.8.1 for Linux (PHP 5.4.7)
Production:
Drupal 7.17 on PHP 5.3
Comment #5
David_Rothstein CreditAttribution: David_Rothstein commentedCommitted to 7.x - thanks! http://drupalcode.org/project/drupal.git/commit/2f00fb3
Looks like a very similar issue to #1614292: image_style_delete_form doesn't take form_state by reference...
I also looked into why this isn't in Drupal 8, and it seems to just be gone. #1398040: Detect if default configuration of a module has been changed, and allow to restore to the original is the issue to discuss that further.
Comment #6
David_Rothstein CreditAttribution: David_Rothstein commentedDrupal 7.18 was a security release only, so this issue is now scheduled for Drupal 7.19 instead.
Fixing tags accordingly.
Comment #8
David_Rothstein CreditAttribution: David_Rothstein commentedDrupal 7.19 was a security release only, so this issue is now scheduled for Drupal 7.20 instead.
Fixing tags accordingly.
Comment #9
David_Rothstein CreditAttribution: David_Rothstein commentedDrupal 7.20 was a security release only, so this issue is now scheduled for Drupal 7.21 instead. For real this time... I think :)
Fixing tags accordingly.
Comment #10
David_Rothstein CreditAttribution: David_Rothstein commentedTrying to fix the issue tags again...
Comment #11
David_Rothstein CreditAttribution: David_Rothstein commentedFixing tags since Drupal 7.21 only contained a fix to deal with fallout from the Drupal 7.20 security release. Hopefully this is really the last time I do this and this will be released in Drupal 7.22 for real :)
Comment #11.0
David_Rothstein CreditAttribution: David_Rothstein commentedminor syntax edit.