Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Tax
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Nov 2011 at 13:56 UTC
Updated:
2 Feb 2012 at 20:40 UTC
Jump to comment: Most recent file
Comments
Comment #1
rszrama commentedNot sure what the best solution here will be. The problem appears to be that deleting a field isn't clearing the field info cache early enough, and deleting the field appears to trigger hook_field_attach_load() for some reason. I'm curious to know exactly why that's happening - does Drupal really go through and load every single entity containing a deleted field to remove the old data? If so, is there some secret batch here I don't know about?
Comment #2
recrit commentedfield_ui.admin.inc line 1742 calls field_purge_batch() to purge fields with minimal or no field data. The function field_purge_batch() only sends a stub entity (as returned from EntityFieldQuery) to field_attach_load(). So commerce_tax_field_attach_load() is called and loops through all defined fields on the product; however, these fields will not exist on this stub entity sent from field_purge_batch().
Comment #3
stan turyn commentedsubscribing
Comment #4
vasikei can confirm this error message.
an easy and quick solution to avoid this error will be to add a check for this the "Notice: Undefined property" right before ethe line pointed by the error message.
instead of
Comment #5
rfay@vasike please provide a patch. Stays in "active" until there's a patch.
Comment #6
vasikeok. here is the patch.
Comment #7
rszrama commentedCool, that did it. Very poor form for Drupal to be functioning this way, but I'm not sure what ya can do. If a hook docblock and parameter name indicates it gets an entity (or set of entities), then it should always do just that. C'est la vie... I've simply put a comment on http://api.drupal.org/api/drupal/modules--field--field.api.php/function/... for now documenting this behavior. Not sure if this should be pushed upstream to Drupal core or not. Anyone else think so?
Committed #6, though I changed it to !empty() instead of !isset().