I'm getting this message after selecting "Continue to next step" on the Review Order page.

Warning: Illegal offset type in commerce_subscription_form_commerce_paypal_wps_redirect_form_alter() (line 1241 of *****/sites/all/modules/commerce_subscription/commerce_subscription.module).

The error displays for a few seconds and then I am redirected to the Paypal site.

Any idea what is causing this and how I can correct it?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

DuaelFr’s picture

I have the same issue and after reading the code I think it is not easilly fixable.

In fact, the module defines a field and a property with the same name "subscription_trial_period". The issue is that despite of the fact that a custom getter has been defined on the property, Drupal gets the value directly from the field.

As I said, the issue is a bit painful because the most proper way to fix it would break the backward compatibility.
Here is a quick fix for this issue. It is far from perfect but it seems to work.

DuaelFr’s picture

Category: support » bug
Status: Active » Needs review
Tiam .’s picture

I found the actual reason is cause by $product_wrapper->subscription_trial_units->value() returning an array which is

array([0]=>4);

$units = array(
COMMERCE_SUBSCRIPTION_DURATION_DAYS => 'D',
COMMERCE_SUBSCRIPTION_DURATION_WEEKS => 'W',
COMMERCE_SUBSCRIPTION_DURATION_MONTHS => 'M',
COMMERCE_SUBSCRIPTION_DURATION_YEARS => 'Y',
);

Which mean the value we need here is array(4)