When using the admin UI (with entity that has bundles) and accessing the menu-path of the entity adding form, the function entity_ui_get_page_title() calls core function entity_extract_ids() with entity object which does not have bundle-property set, which results to EntityMalformedException "'Missing bundle property on entity of type".
Entity API 1.1->1.2 update added following lines (746-748) to entity.ui.inc:
if (isset($entity)) {
list(, , $bundle) = entity_extract_ids($entity_type, $entity);
}
In this case the $entity here is from EntityAPIController::create(), only with one property named "is_new", but entity_extract_ids() mandates the $entity should have it's bundle property set as defined in entity-info.
Should there be a check that $entity is "not new", also, before calling entity_extract_ids()?
Comment | File | Size | Author |
---|---|---|---|
#1 | 2074215-get-page-title-1.patch | 518 bytes | bucefal91 |
Comments
Comment #1
bucefal91 CreditAttribution: bucefal91 commentedHello!
I observe the same bug in 7.2 version of entity API module. Your suggestion seems correct to me and I made a patch based on it. Please, review.
Thank you!
Comment #3
bucefal91 CreditAttribution: bucefal91 commentedCrap... the provided patch should be applied against 7.x-1.x-dev. I am going to change the version in this issue.
Comment #4
bucefal91 CreditAttribution: bucefal91 commented#1: 2074215-get-page-title-1.patch queued for re-testing.
Comment #5
thirdender CreditAttribution: thirdender commentedThis definitely fixes an issue caused by Entity API 7.x-1.2 and the Units of Measurement module. Is it possible to get this committed to the -dev branch?
Comment #6
jordan8037310 CreditAttribution: jordan8037310 commentedThanks for the fix, bucefal91!
Comment #7
manuelBS CreditAttribution: manuelBS commentedThe patch also works for me, thanks!
Comment #8
bethsoderberg CreditAttribution: bethsoderberg commentedThe patch worked for me as well. Thanks bucefal91!
Comment #9
PlayfulWolf CreditAttribution: PlayfulWolf commentedIs this patch safe to apply to 1.3 version?
EDIT: Latest dev maybe?...
Comment #10
PlayfulWolf CreditAttribution: PlayfulWolf commentedPatch works for me too. Applied to 1.3 version manually.
Comment #11
fagoNope, even new entities must have a bundle. So the problem is the code which creates the entity object without bundle.
Comment #12
SocialNicheGuru CreditAttribution: SocialNicheGuru commentedis this still an issue in entity 1.5?
Comment #13
PlayfulWolf CreditAttribution: PlayfulWolf commentedYes. Just upgraded and tested.
Comment #14
klokie CreditAttribution: klokie commentedpatch worked for me against entity 1.5. Thanks!
Comment #15
stefika CreditAttribution: stefika commentedJust to say, patch is worked for entity 1.4. Updated manually. Thank you!
Comment #16
asb CreditAttribution: asb commentedPatch still applies (almost) cleanly against entity 1.5:
We have at least half a dozend reports that the patch is working and fixes an issue, changing status to get it into dev.
Comment #17
fagoStill, it's wrong and not the right fix - see #11.
Comment #18
bucefal91 CreditAttribution: bucefal91 commentedHello!
For those who came here because of Units module: it turned out that Units module contained a bug, which I just fixed. The bug is fixed in 7.x-1.0-beta1 release of Units module. It was released a few minutes ago.
fago, sorry for blaming Entity API module. To your credit, you never accepted the bug was in Entity API module :)
I am not closing this issue, because I think there are folks who participated in here not because of Units module.