I have downloaded and installed the Matrix Module just fine. However I do get an error once I try and add the field to a content type.
After I choose Matrix Field and click save, I am directed to the field settings page, with a pink block error stating:

warning: Invalid argument supplied for foreach() in /my-sites-path/modules/matrix/matrix.module on line 243.

If I proceed, and "ignore" the error, I create content, the error is displayed but the matrix field is also displayed. However after filling out the fields and saving the node, I get the previous error and the following one:

warning: array_unshift() [function.array-unshift]: The first argument should be an array in /my-sites-path/modules/matrix/matrix.module on line 291.

This CCK field is the perfect field for what I am working on, any support would be appreciated.

CommentFileSizeAuthor
#10 matrix-372112-fix.patch487 byteslongwave
#9 matrix-372112.patch487 byteslongwave

Comments

aaron1234nz’s picture

There should be a big warning on the module install page saying that the CCK part of fusioncharts is not complete and should not be used (cause it not finished). However, I have done some work on it this last week. I have a couple of things to add and some dependencies to check then I will release a working version of fusioncharts for cck.

aaron1234nz’s picture

Status: Active » Fixed

The latest dev version contains a working version of fusioncharts for cck

aaron1234nz’s picture

Status: Fixed » Active

Sorry about the previous two posts. Please ignore them. I've been working on the CCK part of one of my other modules (Fusion charts) and I somehow thought this issue was related to that project, no matrix field.

zigma’s picture

Thank you for supporting such a wonderful module.

I am facing similar issues.
Appreciate any input.

In fact i am also facing issue iwth installation, But the installation related issue is not consistent.

Rosamunda’s picture

subscribing. This module rocks!

aaron1234nz’s picture

Thanks, turned out to be a simple mistake on my part. Fixed now.

aaron1234nz’s picture

Status: Active » Fixed
msimanga’s picture

Hi,

I am using ver 6.x-1.3 and still getting the error, I have pasted the error below. This error only seems to happen if you have more than one matrix field in a content type.

Mpume

* warning: array_unshift() [function.array-unshift]: The first argument should be an array in C:\Apps\xampp\htdocs\infossist\sites\default\modules\matrix\matrix.module on line 292.
* warning: Invalid argument supplied for foreach() in C:\Apps\xampp\htdocs\infossist\sites\default\modules\matrix\matrix.module on line 299.
* warning: Invalid argument supplied for foreach() in C:\Apps\xampp\htdocs\infossist\sites\default\modules\matrix\matrix.module on line 314.
* warning: array_unshift() [function.array-unshift]: The first argument should be an array in C:\Apps\xampp\htdocs\infossist\sites\default\modules\matrix\matrix.module on line 292.
* warning: array_unshift() [function.array-unshift]: The first argument should be an array in C:\Apps\xampp\htdocs\infossist\sites\default\modules\matrix\matrix.module on line 292.

longwave’s picture

Component: Miscellaneous » Code
Status: Fixed » Needs review
StatusFileSize
new487 bytes

I am running into the same issue as msimanga. I have attached a patch that checks $field_info before using it which suppresses these error messages.

longwave’s picture

StatusFileSize
new487 bytes

Rerolled the patch as I put brackets in the wrong place last time!

aaron1234nz’s picture

I've applied your patch and made a few other changes to the display function. Hopefully this issue is fixed now.

jasonqi’s picture

I might not have the CVS access to do the patch.

I think between line 294 and 295, add

ksort($row);

it will be :


    foreach ($field_info['data'] as $row_index => $row) { 
      ksort($row);
      foreach ($row as $cell_index => $cell_value) {

In some case, the sequence of records in table of "node_field_matrix_data" is unexpected.

Not sure if it is needed to add
ksort($field_info['data']);
before line 294

March 16, 2009 UPDATE, I tested it and ksort($field_info['data']); is needed. for sure now

aaron1234nz’s picture

Thanks for spotting this. I had overlooked this possibility! I think your right on the mark!

aaron1234nz’s picture

Status: Needs review » Fixed

Status: Fixed » Closed (fixed)

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