Closed (fixed)
Project:
Manual Crop (old)
Version:
7.x-1.4
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Reporter:
Created:
22 Nov 2012 at 15:12 UTC
Updated:
12 Jan 2013 at 14:30 UTC
Jump to comment: Most recent file
After upgrading to Manual Crop 7.x-1.4 I'm getting a fatal error when I try to edit the commerce_price field on one of my products:
Fatal error: Unsupported operand types in /path/to/manual-crop/manualcrop.admin.inc on line 386
It looks like the manualcrop_supported_widgets($widget_type) check is failing. The assignment of $widget_type on line 377 doesn't match the structure I'm seeing in a var dump of the form element.
// Get the instance and widget type.
$element = &$form['instance'];
$widget_type = $element['widget']['type']['#value'];
Looks like it should be
// Get the instance and widget type.
$element = $form['#instance'];
$widget_type = $element['widget']['type'];
Patch to follow.
| Comment | File | Size | Author |
|---|---|---|---|
| #10 | manual-crop-commerce-compatibility-1847960-10.patch | 611 bytes | matthijs |
| #1 | manualcrop-unsupported_operand-1847960-1.patch | 616 bytes | garrettc |
Comments
Comment #1
garrettc commentedComment #2
garrettc commentedHmm, this might not work. Some forms have
#instanceand some have justinstance. I'm not quite sure what the difference between them is supposed to be.Comment #3
matthijsThanks for your patch, I ended up using:
With this code both cases are covered ;-)
Comment #4
garrettc commentedI'm still getting the error, but now with a different line number, on the latest dev (7.x-1.4+12-dev, 23rd November):
Fatal error: Unsupported operand types in /Users/garrettc/Work/sandbox/wdcs/sites/all/modules/Media/manual-crop/manualcrop.admin.inc on line 391It still seems that the manualcrop_supported_widgets($widget_type) check is failing. Manual crop shouldn't need to add anything to a commerce_price field.
Comment #5
matthijsA better patch has been applied and committed.
Comment #6
garrettc commentedSorry, but it's still throwing the error, different line number again (7.x-1.4+15-dev, 2nd December)
Fatal error: Unsupported operand types in /Users/garrettc/Work/sandbox/wdcs/sites/all/modules/Media/manual-crop/manualcrop.admin.inc on line 387Comment #7
matthijsWeird, I tried this myself on a clean Commerce installation and the problem was fixed after applying the patch... I'll have another look at it!
Matthijs
Comment #8
matthijsComment #9
garrettc commentedIf it helps diagnose it I've just discovered that it's happening with commerce_giftaid fields too.
Anything else I can do to help just shout. I'm keen to get the upgrade installed.
Comment #10
matthijsI'm sorry it took me a while, but could you try the attached patch? Thanks!
Comment #11
garrettc commentedIt looks like it's working, thank you.
I applied the patch to the latest dev version (20th Dec) and edited the settings on both commerce_price and commerce_giftaid fields. No error.
Comment #12
matthijsPatch applied and committed! Thanks for your feedback!