Hi,

I just updated my whole site to the latest 7.22 version and drupal commerce. There was a bug in the recommended commerce release so I moved to the DEV version to solve this problem. now I am getting the following error:


Notice: Undefined index: path in commerce_cart_field_attach_view_alter() (line 2401 of /home/.../www/www/sites/all/modules/commerce/modules/cart/commerce_cart.module).

The problem is that is doesn't appear for the admin user, but only for anonymous users - and the message appears full in red at the top of the page!!!!

Have run update.php, cleared caches

Slight panic....

Thanks
Rich

CommentFileSizeAuthor
#2 1968718.empty_entity_uri.patch776 bytesrszrama

Comments

rszrama’s picture

Status: Active » Postponed (maintainer needs more info)

Not enough info here to debug this. I haven't seen this locally, but I'll need to be able to reproduce it to fix it. For example, what is this Add to Cart form attached to? And why might an anonymous user not have access to view it but still see its fields rendered somewhere?

rszrama’s picture

Priority: Major » Normal
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new776 bytes

That said, this patch would fix your issue. I'd still hope to understand the underlying issue, though, as I'm not sure this patch wouldn't have undesired side effects. I'm also not sure this issue is related to Commerce 1.6, as this code hasn't seen any recent changes afaik.

richH’s picture

Hi

thanks for the patch - I'd added something similar to keep the errors off the screen. I'll describe the setup later, but I just viewed a calendar page and got this...

Notice: Undefined index: path in calendar_plugin_row->render() (line 401 of /home/..../www/www/sites/all/modules/calendar/includes/calendar_plugin_row.inc).

which is essentially the same error. But in the calendar module. So I'm starting to think that something isn't defined in the core anymore. I updated today to 7.22 as well so I'm hoping that this might all be related!

getting wobbly from shocks...!

Thanks
Rich

p.s. To get rid of the above error I added the following code before line 401. Now I have to go and have a hot shower to get rid of the shame of such a nasty hack on a live site! This is guessing at its best.

if (!isset($uri['path'])) {
        $uri['path'] = $_SERVER['PHP_SELF'];
 }
rszrama’s picture

Nothing in http://drupal.org/drupal-7.22-release-notes jumps out at me as having affected entity_uri(). Please keep us in the loop if you determine the problem does sit deeper than Commerce. About the only way I can imagine someone running into this problem strictly with Commerce would be by adding a product reference field to a product type and somehow rendering out that product somewhere w/ the reference field as an Add to Cart while bypassing access control. And I'm guessing that's not happening anywhere in the wild - and if it is, it shouldn't be. : P

richH’s picture

That sounds too complicated to be something that I would have done. I think the issue with the calendar means that this is a more general issue with this entity path thing. But to honest, I haven't really got a clue where to start. Thinking cap on...

Thanks for all the help.
Rich

rszrama’s picture

Status: Needs review » Fixed

I've committed my patch. Seeing as how Commerce can return NULL entity URIs in some cases, it stands to reason other modules might be doing the same thing. This patch will protect us in the event a product reference field is attached to such an entity.

richH’s picture

Hi,

looks very nice - have installed it and don't have any errors.

Thanks a lot for the quick response.

Cheers
rich

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

add note about clearing cache