Problem
After upgrading to 7.14, you can receive the error:
Notice: Undefined index: default_image in image_field_prepare_view() (line 207 of \modules\image\image.field.inc).
Solution
A patch to fix this has been committed to 7.x and will be available in 7.15. In the meantime, visiting the image field settings form and clicking Save will resolve the issue.
Original report by pgglass
// Text of original report here.
(for legacy issues whose initial post was not the issue summary)
Just upgraded to Drupal 7.14 and immediately received the following error:
Notice: Undefined index: default_image in image_field_prepare_view() (line 207 of C:\Users\Philip Glass\Sites\upofa\modules\image\image.field.inc).
Nothing else to tell... I just simply upgraded and did nothing else.
Comment | File | Size | Author |
---|---|---|---|
#4 | drupal-1558548-4.patch | 821 bytes | tim.plunkett |
#3 | drupal-1558548-3.patch | 639 bytes | tim.plunkett |
Comments
Comment #1
pgglass CreditAttribution: pgglass commentedComment #2
sunhttp://api.drupal.org/api/drupal/modules!image!image.field.inc/function/image_field_prepare_view/7
The initial condition needs to be changed into
!empty($field['settings']['default_image'])
Comment #3
tim.plunkettMakes sense.
Are we sure it won't hurt to have one for the elseif as well?
Comment #4
tim.plunkettLet's be explicit here.
Comment #5
sunThanks :)
Would probably be a good idea to open a follow-up issue to grep for all $field['settings'] and $instance['settings'] throughout core. I can only guess that most of the field type modules wrongly assume that all of their settings always exist. :(
Comment #6
benjy CreditAttribution: benjy commentedsubscribe, same error here.
Comment #7
batigol CreditAttribution: batigol commentedSame here.
Comment #8
webchickGreat. Thanks for the fast fix!
I don't mind committing this as a hotfix really, but I'm wondering if it's possible to add test coverage for this. I think the answer's no, because it only comes up on a 7.x => 7.14 upgrade but tagging just to see.
Also, we need a 8.x version of the patch, too. That should be fairly easy so tagging Novice.
Comment #9
webchickMore descriptive title.
Comment #10
sun#4: drupal-1558548-4.patch queued for re-testing.
Comment #12
sund'oh. Patch would probably also apply cleanly to D8, but alas... /core... ;)
Regarding tests: Nope, intra-D7 update tests are not supported currently. Once #1364798: Impossible to generate meaningful diffs of upgrade db dumps lands, the situation might look different, and I definitely would like to see such tests, but until then, it's not possible.
Comment #13
PROMESsubscribe, same error here.
Comment #14
Anonymous (not verified) CreditAttribution: Anonymous commentedSame issue immediately after applying D7.14
Comment #15
fakingfantastic CreditAttribution: fakingfantastic commentedsame
Comment #16
webchickOk, I figured out I can patch -p0 the 7.x patch from the /core directory so don't need that re-roll after all.
Committed and pushed to 8.x and 7.x. Thanks!
Comment #17
webchickI've also added this to the "known issues" section of the release announcement: http://drupal.org/drupal-7.14#known-issues
Comment #18
shaostudio CreditAttribution: shaostudio commentedI wanted to re-size my images. I received the same error message after upgrading to Drupal 7.14 and changing the Maximum image resolution in field_image. I kinda of went around that and left the Maximum image resolution blank. I set the image size in the Image Style under Manage Display. It works for my situation but may not work for others if you require minimum and maximum resolution.
Comment #19
slippast CreditAttribution: slippast commentedSubscribed! Thanks for looking into this problem.
Aside from a patch is there a quick fix to get around this?
Comment #20
BTMash CreditAttribution: BTMash commentedIn my instance, I resaved the field settings and it was working just fine again after that.
Comment #21
slippast CreditAttribution: slippast commentedThat appeared to work for me too. Resaved the field...no warning. Thanks!
Comment #22
jnettikI was getting the error in #1559696: Notice : Undefined index: default_image in image_field_update_instance() - during reconfigure but on line 505. Tried the patch in #4 and I'm not getting the error.
Comment #23
webchickUpdated the issue summary to point out the problem/solution to hopefully prevent more "me too" comments. Anyone please feel free to clarify it further.
Comment #24
pgglass CreditAttribution: pgglass commentedNot sure if this means anything but I ran an update using the update script and found there were 4 updates pending. The error disappeared and seems to have fixed the problem but I incurred another problem... my "People" page disappeared. Had to revert to my backup.
Comment #25
StephanieFuda CreditAttribution: StephanieFuda commentedSubscribe.
Same error since i upgraded yesterday.
Comment #26
tim.plunkettFixing status to clarify that this is in 7.x-dev and was committed to 8.x.
Comment #27
frankcarey CreditAttribution: frankcarey commentedLooks like this was fixed, but I just wanted to clarify that we are seeing this on fresh jenkins builds, not upgrades. Earlier webchick described "it only comes up on a 7.x => 7.14 upgrade". We have all our content types exported into features module, so they might have "legacy" settings now that we should upgrade and reexport?
Comment #28
BTMash CreditAttribution: BTMash commented@frankcarey, since you are using features, it might be the case - so yes, they should get upgraded and then exported.
Comment #29
frankcarey CreditAttribution: frankcarey commentedYes, re-exporting with features adds the 'default_image' => 0, and thus should solve the issue. Others using features or defining modules in code will likely run into that as well.
Comment #30
Leeteq CreditAttribution: Leeteq commentedIs @sun's comment in #5 addressed in a separate issue?
Comment #31
Christopher James Francis Rodgers CreditAttribution: Christopher James Francis Rodgers commented[Note aside for non-developers updating from
D7.12 to D7.14]
This error followed my update; but thee error is now gone.
I typed "update.php" without the double-quotes,
following my site's home name,
(Eg. www.my-site-example.com/update.php)
and pressed thee "Enter" key.
This runs the database updates that ought to be run
after any update to a Drupal site.
I had forgotten.
: o )
Comment #32
patoshi CreditAttribution: patoshi commentedupdated core to 7.14 and received same error when going to a page with images... but after doing a cache clear it seems to have gone away.... did someone resolve it the same way? and did it come back?
Comment #33
webchick.
Comment #34
dafederI also got this initially but cleared the cache and it went away.
Comment #35
David_Rothstein CreditAttribution: David_Rothstein commentedWent ahead and added this to CHANGELOG.txt now: http://drupalcode.org/project/drupal.git/commit/4f3f159
Comment #36
Anonymous (not verified) CreditAttribution: Anonymous commentedI question the decision to use !empty() instead of isset() for the patch? I understand the differences between empty() and isset() from the PHP perspective and for this IMO isset() should have been used.
Comment #37
cappersg CreditAttribution: cappersg commented@ #34: Clear cache did not work for me - even after a browser restart (I'm using Google Chrome)
Tried the suggested code changes: only gets the page to crash.
For me this issue should not be tagged "fixed".......
UPDATE: when carefully running the update scripts again AFTER the suggested visit to "image field settings form" and clicking "Save" there & the clear cache it is solved for me too. It looks like the order of actions can be significant.....
Comment #38.0
(not verified) CreditAttribution: commentedUpdating issue summary with problem/solution.