Hi,
I have that warning after perform custom pricing rule(drupal commerce) with actions:
-Calculate a value
-Set the unit price to a specific amount

Warning: Illegal string offset 'type' in rules_action_data_calc() (line 78 of [root]/sites/all/modules/rules/modules/data.eval.inc).

I looked at data.eval.inc and there is an array which haven't 'type' key...
Is this a bug or I done something wrong?

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

raulo’s picture

I had the same problem. I deleted lines 78, 79 and 80

if ($var_info['type'] == 'interger') {
$result = (int) $result;
}

and the problem goes away

a.ross’s picture

This problem suddenly came up on a test site I didn't touch for a few weeks. I did, however, upgrade Ubuntu to 12.10. Haven't seen it before the upgrade, so that might have something to do with it.
PHP version right now is 5.4.6, in Ubuntu 12.04 it's currently 5.3.10

krlucas’s picture

Status: Active » Needs review
FileSize
613 bytes

I encountered this same issue with PHP 5.4. Here's a patch.

Status: Needs review » Needs work

The last submitted patch, rules-illegal-offset-1776582-3.patch, failed testing.

peterpoe’s picture

Version: 7.x-2.2 » 7.x-2.x-dev
Status: Needs work » Needs review
FileSize
568 bytes

$var_info is never an array, since rules_array_key() extracts an array key.
(Hopefully) proper patch attached.

smokris’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed @peterpoe's patch in #5 — it resolves Rules's misuse of rules_array_key(), and passes my tests. RTBC.

zterry95’s picture

zterry95’s picture

report the same problem. and hope fix this with the patch.

fago’s picture

Status: Reviewed & tested by the community » Fixed

Good catch - thanks committed.

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

correcting typos...

Yusadolat’s picture

Issue summary: View changes

mine was reporting Warning: Illegal string offset 'calc' in views_calc_fields_form_validate() (line 323 of C:\xampp\htdocs\edawah\sites\all\modules\views_calc\views_calc.module).