Closed (fixed)
Project:
Composite Layout
Version:
6.x-1.0-beta7
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
5 Aug 2009 at 14:42 UTC
Updated:
26 Aug 2009 at 17:50 UTC
* warning: preg_match() expects parameter 2 to be string, array given in /home/nicholas/workspace/campaign/includes/bootstrap.inc on line 771.
* warning: Invalid argument supplied for foreach() in /home/nicholas/workspace/campaign/sites/all/modules/composite/modules/content/composite_cck.module on line 194.This error is seen when going to Zones tab, here are the steps to reproduce:
You will now see this error.
You will also find an extra field that should not be under the fields section. It looks to be an array being used as a string. Field value: Metrics [0] (my field was called metrics).
Comments
Comment #1
bengtan commentedHah, have I heard of flexifield.module before? Nope. Do I know what it does? Nope.
Anyway ...
It's a bit strange. The paragraph of code is:
but I explicitly check $field_type['formatters'] is an array before calling foreach, so it shouldn't be complaining afterwards ... Not sure.
I think I'll wait until flexifield hits beta or RC before looking at this in detail.
Comment #2
nicholas.alipaz commentedOK, understood that you want to wait, but I kind of doubt that much of the core implementation will be changing before an RC. That is since a number of large sites have already started using it, and the developer seems to be aware of that. The odd thing seems to be that it is finding, I believe, filefields within the flexifields. Hence the Field value: Metrics [0] I mentioned in my first post. The issue only occurs upon adding file/imagefields within the flexifields.
Thanks for the response and I look forward to a resolution. If I find a solution then I will post a patch.
Comment #3
bengtan commentedHi,
I have committed a fix.
If you'd like to hand patch your system, do the following:
In the file .../composite/modules/content/composite_cck.module, replace the function _composite_cck_preview_element() with the following definition:
The issue arises only if you have a multi-valued field of type flexifield. In the zones tabs of a composite enabled node, Composite Layout tries to preview the values of individual fields. Problem is, the value of a flexifield is an array, and this causes some downstream functions (in bootstrap.inc) to choke because they are expecting a string, or something convertable to a string.
The fix tests for this, and does not attempt a preview if the field value is an array.
PS: Field value: Metrics [0] is the first value of the Metrics multi-valued field. That is actually operating as intended.
If you still have issues with this, please re-open this thread and let me know.
Thanks.
Comment #4
nicholas.alipaz commentedWow, thanks for the fast work on this. Well the previous error is fixed, but there is now a new error:
warning: Invalid argument supplied for foreach() in /home/nicholas/workspace/campaign2/sites/all/modules/composite/modules/content/composite_cck.module on line 194.I can only guess that something is getting setn to that function in the wrong form.
Thanks again.
Comment #5
nicholas.alipaz commentedI feel this issues needs a title change.
Comment #6
bengtan commentedAh, the warning message in comment #4 of this thread is actually an old bug.
See comment #4 of #465762: After upgrade 6.11->6.12: Getting errors when visiting /composite_zones and changing zones for a fix.
Or you can wait for the next release of Composite Layout (whenever that will be) which will automatically include this fix.
Comment #7
nicholas.alipaz commentedThat does it. Thanks. Sorry I hadn't noticed that warning was unrelated to this bug. Definitely fixed.