array_merge() error on Subform setup/creation + relationship creation problems

svendecabooter - December 7, 2006 - 18:29
Project:Subform
Version:4.7.x-0.26
Component:Miscellaneous
Category:support request
Priority:normal
Assigned:MrTaco
Status:active
Description

I've been trying to get the Subform module to work on a fresh Drupal testsite, because it looks like an interesting module.
But during the setup and when adding a cck field, i get a lot of errors like the following:

warning: array_merge() [function.array-merge]: Argument #2 is not an array in H:\Projecten\drupal47test\project\modules\cck\content.module on line 733.
and also on line 746.

Now here is about exactly what i did:

All modules were downloaded today, so they are the newest versions of each.
I first installed cck-4.7.x-1.x-dev and views-4.7.x-1.2.

I made two content types in cck, being 'album' and 'label'. The goal of this test is to create a musicalbum node with all sorts of info on the musicalbum. When creating an album, i want to be able to add a reference to a musiclabel (eg. Universal Music), stored in the cck type 'label', but also the option to create a new 'label' item when creating an 'album', if the label shouldn't be available yet in the system.

So far so good. Now i downloaded and installed subform-4.7.x-0.26. As pointed out in the readme file, i enabled content_type_reference, persistent_fieldset and subform modules.

Now i was a bit confused on how to proceed, so i choose 'create content > relation type', and there was only 1 field available to fill in, 'Title', so i filled in a title, 'labelrelation'. Because this content type 'content_relation_type' doesn't do more then providing a Title, i got a bit more confused, because the readme.txt talks about creating a relationship between 2 cck types, but i don't see a way how.
The only thing i could think of, was adding fields to the content_relation_type, but when i hit the 'add field' tab, i get the array_merge() errors mentioned above. So now i'm posting the issue, because i have no clue on how to get this working.
I want to create a relationship between the 'album' cck and the 'label' cck, but have no idea how, and get the array_merge() errors multiple times.

Can anyone tell me how to get rid of the errors, and how i am supposed to create relationships exactly?

Thanks a lot :)

#1

MrTaco - December 7, 2006 - 18:46
Assigned to:Anonymous» MrTaco

hi

that cck "relation type" is a type created by subform during its installation

on my system it seems to work fine, but its possible that you need to clear your cck cache in order for it to recognize the new content type that subform creates (this is because subform creates the content type by editing cck tables, not by calling cck functions (because there are no such cck functions) )

you can get cck to rebuild its content type cache by just creating a some random type and then deleting it

if that doesn't work let me know. i did 3 full drupal reinstalls from scratch this morning, and they all went flawlessly, so i'm kind of perplexed as to how its turning out differently for you.

but, thank you for reporting the problem you have, and i'm sorry that the install is not smoother. i promise you i will work through these install problems until it is some for everyone

#2

svendecabooter - December 7, 2006 - 19:59

Thanks for the explanation.
I will look into it a bit more tomorrow.

Perhaps the problem is with CCK instead of with this module, because i'm getting it quite frequently now.
I will try with different cck versions and let you know if i found out anything..

Can u explain me some more:
when i create content of type 'relation type', i am supposed to get 2 dropdown boxes or whatever to select the 2 cck types to connect?
And when i check the number of fields the cck type 'content_relation_type' has, i only see 1, being title... Are there supposed to be more?
If there are, then i guess the installation went wrong somehow, and that's why it doesn't work as it should ofcourse...

#3

MrTaco - December 7, 2006 - 20:11

yes, actually the "relation type" should have 4 custom fields (5 including title).

two fields are to specify content type, and two fields specify cardinality

if you empty the "cache" table in your database, that will force CCK (and all other modules) to rebuild any data that they have cached.

in the case of CCK, it caches its idea of what content types it is currently responsible for, and how they are structured

so forcing CCK to rebuild that, may fix your "relation type" problem

#4

svendecabooter - December 7, 2006 - 20:26

Yeah i already did empty the cache, without any changes..
I tried cck-4.7.x-1.0 instead of -dev, but that didn't matter either.

The errors occur when i try to add a field to any cck content type there is.
The next thing i did was delete the 'content_relation_type', and all errors suddenly disappeared.
So the problem must be the installation process of this cck type, as i figured out before.

I will try to do a 'manual install' of the cck type, if i can figure out the code, and see what that gives :)

I don't know if it matters, but maybe i should give my specifications:
Drupal 4.7.4
PHP 5.1.6
MySQL 4.1

I'll keep you updated on what i find out

#5

svendecabooter - December 7, 2006 - 20:55

Hi,

If i perform all the database changes mentioned in subform.install manually, everything runs smoothly.
I was able to create a relationship and do all the stuff it is supposed to do :)

If i find some time, i'll try to check what exactly caused the problem...

#6

MrTaco - December 7, 2006 - 21:16

yay :)

#7

MrTaco - December 8, 2006 - 20:51

The following was all done on php 4.4.4 and mysql 5.0.22:

i deleted my entire testbed drupal install (folder and all subfolders) and the database it had previously pointed at.

Then i reinstalled drupal with freshdownloads of drupal 4.7.4, cck at http://drupal.org/files/projects/cck-4.7.x-1.0.tar.gz, views at http://drupal.org/files/projects/views-4.7.x-1.2.tar.gz and subform at http://drupal.org/files/projects/subform-4.7.x-0.26.tar.gz .

I enabled all cck modules, views and views_ui, and all the subform modules, all at the same time (in one step).

I received no errors.

#8

MrTaco - December 12, 2006 - 00:45

i'm now doing all my development in:

php 4.4.2
mysql 4.1.15
apache 2.2

and besides adding nested subform support, i've also validated the module as E_ALL compliant (which should improve its stability on old versions of php)

i've just released subform version 0.30. let me know if u receive any errors in a clean system install (clean meaning no previous install of subform in this system)

#9

MrTaco - December 12, 2006 - 04:23

i haven't done any testing against the dev versions of cck

i test against the cck 1.0 for drupal 4.7.4

so that is what will be most stable for u

#10

rocnhorse - January 9, 2007 - 00:24

I got this error and started in http://drupal.org/node/84634 but it's really a problem with subform.

I think the problem is the node_field records that are created in the subform.install. The error only comes up in PHP 5 because they changed array_merge to require all parameters to be arrays and when unserialize fails it returns FALSE instead of an array.

If the insert statements are run manually they are fine but running them through db_query removes the {} from the serialized data.

When you run

$query = "INSERT IGNORE INTO node_field (field_name, type, global_settings, required, multiple, db_storage) VALUES ('field_type_one_cardinality', 'number_integer', 'a:3:{s:3:\"min\";s:1:\"1\";s:3:\"max\";s:0:\"\";s:14:\"allowed_values\";s:0:\"\";}', 1, 0, 1);";
db_query( $query );

from subform.install ends up being

INSERT IGNORE INTO node_field (field_name, type, global_settings, required, multiple, db_storage) VALUES ('field_type_one_cardinality', 'number_integer', 'a:3:s:3:"min";s:1:"1";s:3:"max";s:0:"";s:14:"allowed_values";s:0:"";', 1, 0, 1);

I think the db_query() code that removes the {} from the query for the database abstraction is removing the {} from the serialized data.

Also shouldn't the table name be surrouned by {} for the database abstraction?

#11

suydam - October 17, 2007 - 01:04

How did you get around this?
I'm running into this same issue....I have serialized data, but when I run it through db_query it's adding my db_prefix to my serialized data! :(
Any ideas?

 
 

Drupal is a registered trademark of Dries Buytaert.