Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DanZ’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

You appear to be using some sort of node access control module. Which one? Have you tried its issue queue?

What are you doing with those product pages? Just viewing them? What happens if you look at a catalog display listing numerous product pages?

The error is happening on $node->nid. The nid value should always be defined except when creating a new node, so there is somehow corrupt data here.

Try installing the devel module and getting a backtrace from that on this error. It should show you what part of the code is messing up. It's quite possibly not related to Ubercart.

This only shows up for anonymous users, but disappears for logged in users.

Check your permissions to make sure that anonymous users can view all content that they should be able to view. You probably have some sort of content on your product pages that they can't view.

G Gavitt’s picture

I am seeing similiar behavior on a new site with just the modules needed to run the cart and order modules. I see the same notice for logged in users and anonymous users.

I found a related issue and a patch for the entity api module (required for cart and order). http://drupal.org/node/1780646#comment-703044. That fixed the same issue I was having for all nodes but it did not fix it for ubercart product nodes.

I did notice that the product module calls the arguments to hook node access in the wrong order.

Line 159 uc_product_module

function uc_product_node_access($op, $node, $account) {

where according to http://api.drupal.org/api/drupal/modules!node!node.api.php/function/hook...

It should be $node then $op. I switched the order in uc_product_module but the same notice still appears.

The weird thing is that older versions of uc_product_module do the same thing with the argument order and I have not seen this notice before. I will have to check which versions of the required modules I am using on this older install.. I am assuming its a combination of the newest versions of the required modules and the newest version of ubercart that make this notice appear.

goldlilys’s picture

I haven't added any node access control modules. The product pages showed up fine without any errors before the upgrade so it's not a problem with the permissions access.

Tested out more what other possible modules of ubercart could be causing it and for some reason when I removed the Subscription Manager module for recurring fees, the error disappeared. Not really sure how to use backtrace in devel, do I just add that to the template for product pages?

G Gavitt’s picture

Sorry to confuse the issue.. I had the uc_recurring_subscription.module installed as well.

I traced it back to the uc_product_edit_access function in the product module. That function is called from
the uc_recurring_subscription.module. It has a menu item that uses the uc_product_edit_access function for an access callback.

  $items['node/%/edit/subscription'] = array(
    'title' => 'Subscription',
    'description' => '.',
    'page callback' => 'drupal_get_form',
    'page arguments' => array('uc_recurring_subscription_product_form', 1),
    'access callback' => 'uc_product_edit_access',
    'access arguments' => array(1),
    'type' => MENU_LOCAL_TASK,
    'file' => 'uc_recurring_subscription.admin.inc',
  );

Commenting out the menu item and clearing the cache removes the notice. Obviously its not a solution but at least I know where its coming from. I am pretty sure this is an issue for http://drupal.org/project/uc_recurring

TR’s picture

Try changing 'node/%/edit/subscription' to 'node/%node/edit/subscription' in the above uc_recurring_subscription module.

TR’s picture

And as a side note, all of the uc_product access callbacks are located in uc_product.module instead of uc_product.admin.inc where the menu definition says to look. That's not causing any problems, but the menu definitions should be changed. The callbacks don't belong in uc_product.admin.inc because that forces the admin include file to always load. So the menu definition is wrong.

G Gavitt’s picture

Try changing 'node/%/edit/subscription' to 'node/%node/edit/subscription' in the above uc_recurring_subscription module.

That fixed the notice. Thanks TR.

longwave’s picture

Project: Ubercart » UC Recurring Payments and Subscriptions
Version: 7.x-3.4 » 7.x-2.x-dev
Component: Other » Code
Category: support » bug
Status: Postponed (maintainer needs more info) » Active

Moving to uc_recurring queue so it can be fixed there.

Anonymous’s picture

#5 worked for me. thanks

jkdaza’s picture

#5 worked for me as well.

Thanks

goldlilys’s picture

#5 worked for me as well. Hopefully this can be changed on the next release. Thanks.

bmarcotte’s picture

# 5 worked for me as well. I'm running the Oct-19-2013 7.2 dev version. Can we commit this?

Thanks to all!
Bob

Avidlearner’s picture

I got this error after a fresh install of Drupal Core 7.25 and Ubercart and configuring product classes. The fresh install of Drupal Core and Ubercart did not cause any issues. It was only after I added product classes in Ubercart that I saw this error. Also, this error was only for anonymous user. I could not regenerate the same error using an admin account.

To resolve the issue, I unchecked the "Product" module under Ubercart-Core. Another workaround would be to delete the classes that could be causing the problem.

univate’s picture

Issue summary: View changes
Status: Active » Needs review
FileSize
1.89 KB

Needs to be tested - but I presume that this would need the argument to the page callback to be updated here as well as the menu item?

Les Lim’s picture

  1. +++ b/modules/uc_recurring_subscription/uc_recurring_subscription.admin.inc
    @@ -110,18 +110,17 @@ function uc_recurring_subscription_overview_submit($form, &$form_state) {
    -function uc_recurring_subscription_product_form($form, $form_state, $product_id = NULL) {
    +function uc_recurring_subscription_product_form($form, $form_state, $node = NULL) {
    ...
    +  if (isset($product)) {
    

    Variable mismatch between $node and $product.

  2. +++ b/modules/uc_recurring_subscription/uc_recurring_subscription.module
    @@ -78,7 +78,7 @@ function uc_recurring_subscription_menu() {
    -  $items['node/%/edit/subscription'] = array(
    +  $items['node/%node/edit/subscription'] = array(
    

    This looks right, but there's also a menu route for 'admin/store/subscriptions/%/edit' that needs the same change.

New patch attached.

Donkzilla’s picture

Try changing 'node/%/edit/subscription' to 'node/%node/edit/subscription' in the above uc_recurring_subscription module.

This fixed it for me. YEARS after the error was discovered it's still not been fixed in the uc_recurring module I installed via drush this morning.

LeDucDuBleuet’s picture

Status: Needs review » Reviewed & tested by the community

The patch in #15 although not applying cleanly against current dev, does the job once applied manually.

Thank you.

shahidaali’s picture

#5 fixed my problem