Early Bird Registration for DrupalCon Atlanta is now open! By registering during our Early Bird Registration window, you’ll save $100. This window ends on 19 January 2025 and will go by quickly, so don’t wait!
This is problem when trying to render Commerce Products. The entity_uri call does not take into account whether the entity uri callback returns NULL or not. So entity API should check to make sure a path index exists.
This causes the following error for each product entity being rendered:
Notice: Undefined index: path in template_preprocess_entity() (line 174 of /Users/matt/Sites/acquia-drupal/sites/all/modules/entity/theme/entity.theme.inc)
If not using the dev version of entity API, then the error is:
Notice: Undefined index: path in template_preprocess_entity() (line line 1029 of /Users/matt/Sites/acquia-drupal/sites/all/modules/entity/entity.module)
Comment | File | Size | Author |
---|---|---|---|
#16 | 2003826-16-check_path_index_uri.patch | 978 bytes | stella |
#11 | entity-check_path_index_uri-2003826-11.patch | 844 bytes | greenmother |
#9 | entity-check_path_index_uri-2003826-9.patch | 843 bytes | greenmother |
#6 | 2003826-6-check_path_index_uri.patch | 946 bytes | stella |
#1 | entity-check_path_index_uri-2003826-1.patch | 1.02 KB | jazzdrive3 |
Comments
Comment #1
jazzdrive3 CreditAttribution: jazzdrive3 commentedPatch attached that checks the 'path" index. This fixes the issue for me.
Comment #2
jazzdrive3 CreditAttribution: jazzdrive3 commentedComment #4
jazzdrive3 CreditAttribution: jazzdrive3 commentedComment #5
jazzdrive3 CreditAttribution: jazzdrive3 commented#1: entity-check_path_index_uri-2003826-1.patch queued for re-testing.
Comment #6
stella CreditAttribution: stella commentedI get these errors with the 7.x-1.1 release. Attaching a patch for this version in case it is of use to anyone else who doesn't want to switch to the dev release and use that patch:
Comment #8
pog21 CreditAttribution: pog21 commentedPatch in #1 fixed error on those lines, but I then got an error on line 185. Looks like the following line needs a similar check:
$variables['page'] = $uri && $uri['path'] == $_GET['q'];
I don't know how to make a patch but changing it manually worked for me.
Comment #9
greenmother CreditAttribution: greenmother commentedpatch for #1 and #8
Comment #11
greenmother CreditAttribution: greenmother commentedComment #12
greenmother CreditAttribution: greenmother commentedComment #13
zendka CreditAttribution: zendka commentedThe notices disappeared when I enabled commerce customer ui.
Comment #14
greenmother CreditAttribution: greenmother commentedI has customer ui enabled. I think this is because of not using product display nodes in my shop, views only.
Comment #15
davidwbarratt CreditAttribution: davidwbarratt commentedThe patched fixed my problem. I was having the problem when trying to render a Commerce Product Entity. Turning on Product UI didn't fix my problem.
Thanks!
Comment #16
stella CreditAttribution: stella commentedPatch reroll for 7.x-1.x
Comment #17
jenlampton+1 RTBC
Comment #18
fagoAfaik this is a known issue of commerce or core. What's the progress over there, isn't it going to be fixed there?
Comment #19
jazzdrive3 CreditAttribution: jazzdrive3 commentedfago,
I'm not sure which issue you would be referring to. If there is one, please point us there.
I've talked with Ryan and this was the clearest way to fix the issue, since not all entities will necessarily have paths. There isn't really anything to be done on the Commerce side.
Comment #20
ippy CreditAttribution: ippy commentedThe two changes in the patch fixed the issue for me. Thank you.
Comment #21
kevinwsauer CreditAttribution: kevinwsauer commentedCan anyone help me? Where do I need to apply this patch?
Comment #22
fagoHere it is: #1275902: Allow entity URI callbacks to indicate that the entity has no URI, and make the User module use that for anonymous users
So the problem really is an issue of core/commerce, so I don't see why we should work around it here. Let's better fix it in core.
Comment #22.0
fagoAdd more details.
Comment #23
jazzdrive3 CreditAttribution: jazzdrive3 commentedCan we not work around it here, while also working to fix in core? At this point, it seems almost impossible to get any patch approved for Drupal 7. I've literally been following several Core issues for over a year, and they can never get to Drupal 7, because they have to first work for the moving target of Drupal 8 before being backported.
Comment #24
astutonet#16 solves my issue with template_preprocess_entity does not check for existing 'path' index.
Comment #25
voloda86 CreditAttribution: voloda86 commented#16 works for entity 7.x-1.2
Comment #26
Exploratus CreditAttribution: Exploratus commented16 worked for me.
Comment #27
GuGuss CreditAttribution: GuGuss commented#16 fixed the issue. I'm using Entity 1.3.
Comment #28
acrosman#16 worked for me against 1.3 as well. I agree with the above requests to get this committed. Doesn't look like it would conflict if the problem were also fixed in core, and in the meantime it would resolve a problem that's been bugging people for almost a year.
Comment #29
sportel CreditAttribution: sportel commentedI can confirm the patch works!
Comment #30
caw67 CreditAttribution: caw67 commented#16 patch works for me
Comment #31
gonssal+1 for commiting the patch.
Even if it's a core issue, your code is still wrong because there's no check for the index.
Comment #32
jenlamptonLooks like there's a consensus to fix the problem here too, so changing status back to RTBC.
Comment #34
fagoNope, we are using the API right - it's core who is wrong. Anyway, this is still not fixed in core and obviously bothering people, so let's make our code more bulletproof.
-> I took #16, made parenthese usage consistent and commited it. Thanks!