I 'm getting this error if I try to add a new address or update an address. What can be the problem? I'm using current dev of ubercart.

CommentFileSizeAuthor
#1 uc_addresses.patch736 byteschecker

Comments

checker’s picture

StatusFileSize
new736 bytes

The problem is that the module does not check if _address_pange_data() results a function name or blankness. Here is a little patch.

megachriz’s picture

Do you have any modules installed that depend on or integrate with Ubercart Addresses?

What is outputted if you add

print_r($form_state['values']['panes']);
print_r($func);
die();

after
$func = _address_pane_data($pane_id, 'callback');
(before the error occurs)?

checker’s picture

Output of $form_state['values']['panes']:

Array
(
    [address] => Array
        (
            [aid] => 8
            [first_name] => sddssd
            [last_name] => sdsd
            [phone] => 
            [company] => 
            [street1] => sdsd
            [street2] => 
            [city] => sdsd
            [country] => 276
            [postal_code] => 2323
            [address_name] => 
            [save] => 0
        )

    [payment] => Array
        (
            [current_total] => 
        )

)

Result of _address_pane_data($pane_id, 'callback'):
-uc_addresses_pane_addres
- (empty)

I'm not using directly another module for Ubercart Addresses but I'm not sure if there is a module that is working with it.

megachriz’s picture

Hm, it's possible a payment module is causing this. Do you know which module adds the field 'current_total' to the form? If not, can you tell me which payment modules you have installed?

I'm also curious what is outputted if you add
print_r($panes);
after
$panes = module_invoke_all('address_pane', NULL);
in file uc_addresses_address_pane.inc (± line 273)

If this is the output:

Array
(
    [0] => Array
        (
            [id] => address
            [callback] => uc_addresses_pane_address
            [title] => Address
            [desc] => Manage the user's addresses and contact information.
            [class] => pos-left
            [weight] => 1
            [show] => Array
                (
                    [0] => view
                    [1] => add
                    [2] => edit
                )

        )

)

then it's probable a form alter function is causing this. And then it's the trick to find out which one.

checker’s picture

It's the module 'uc_checkout_preview' that uses a form_alter causing this fatal error:

$form['panes']['payment']['current_total'] = array(
															'#type' => 'hidden',
															'#value' => NULL,
															);

You have to visit checkout page first to get this error after it.

Nevertheless you should do some checks before you call functions from a variable, isn't it more robust programming code?

megachriz’s picture

I couldn't reproduce this error yet. I have installed:
- Token 6.x-1.14
- Ubercart 6.x-2.x-dev (2010-sep-29)
- Ubercart Addresses 6.x-1.0
- Ubercart checkout order preview pane 6.x-1.1
I had enabled all modules of Ubercart.

What modules do you have enabled?

It's up to the maintainer to decide if a check is required. It still looks like the error occurs because of an other module. Maybe UC Addresses should give an error message when it discovers the callback function it expects does not exists?

grub3’s picture

Pleas apply http://drupal.org/node/931998, it could be a duplicate.

megachriz’s picture

@jmpoure
Can you explain in which way this issue is related to #931998: Various fixes for PostgreSQL & all, please review and apply?

checker’s picture

Maybe UC Addresses should give an error message when it discovers the callback function it expects does not exists?

Who sould help this message? A simple check before calling a non existent function would be enough.

haagendazs’s picture

Assigned: Unassigned » haagendazs

Checker: I am helping out freixas with some of the issues for Ubercart Addresses. Ideally, I'd like to reproduce this error to find out what causes the error instead of just making sure the callback function exists.

  • Similar to what MegaChriz reported in comment #7, I have the same list of modules installed and I'm unable to reproduce this error.
  • In comment #6, you mentioned that you have to visit the checkout page first to reproduce this error. Even after visiting the checkout page first, the 'current_total' value isn't set in '$form_state['values']['panes']' for me, however the functionality of uc_checkout_preview is intact. Is it possible you're using an older version of any of the module listed in comment #6?

Can you attach a list of all your installed modules, so I can use your setup to find the error? If you have the Devel module installed, you can go to this path: 'www.yoursite.com/devel/php' and run the following command to get the list of installed modules (please also provide the version number for the modules that aren't the most recent stable version of the module):

$array = module_list(FALSE, TRUE, TRUE);
print_r($array);

If none of this works, we'll add the patch to a dev version.

megachriz’s picture

Assigned: haagendazs » Unassigned
Status: Active » Closed (cannot reproduce)

I close this issue now as I was not able to reproduce it.