I am using Drupal 6.10 with CCK 6.x-2.1. When I installed Emfield and turned on Embedded Media Field everything was fine, I then turned on Embedded Video Field and got:

* warning: array_merge(): Argument #2 is not an array in /srv/www/htdocs/sites/all/modules/cck/content.install on line 43.
* warning: array_merge(): Argument #2 is not an array in /srv/www/htdocs/sites/all/modules/cck/content.install on line 43.

Any thoughts? Thanks.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Alex UA’s picture

Status: Active » Closed (fixed)

This has been fixed for a long time.

anrikun’s picture

Title: Error on install embed video module » Error on installing: array_merge() [function.array-merge]: Argument #2 is not an array
Version: 6.x-1.0-beta1 » 6.x-2.4
Category: support » bug
Status: Closed (fixed) » Active

I'm opening this again as I just got these errors too on installing emfield 6.x-2.4.

# warning: array_merge() [function.array-merge]: Argument #2 is not an array in [...]\sites\all\modules\cck\content.install on line 43.
# warning: array_merge() [function.array-merge]: Argument #2 is not an array in [...]\sites\all\modules\cck\content.install on line 43.
# warning: array_merge() [function.array-merge]: Argument #2 is not an array in [...]\sites\all\modules\cck\content.install on line 43.
# warning: array_merge() [function.array-merge]: Argument #2 is not an array in [...]\sites\all\modules\cck\content.install on line 43.

Using Apache2 + PHP 4.3 on Windows XP.

anruether’s picture

I got this when I added a video field to a content type:

warning: array_merge() [function.array-merge]: Argument #2 is not an array in .../sites/all/modules/emfield/emfield.cck.inc on line 163.
warning: array_merge() [function.array-merge]: Argument #1 is not an array in .../sites/all/modules/emfield/emfield.cck.inc on line 163.
warning: array_merge() [function.array-merge]: Argument #2 is not an array in .../sites/all/modules/emfield/contrib/emvideo/emvideo.module on line 584.
warning: array_merge() [function.array-merge]: Argument #2 is not an array in .../sites/all/modules/emfield/emfield.cck.inc on line 163.
warning: array_merge() [function.array-merge]: Argument #1 is not an array in .../sites/all/modules/emfield/emfield.cck.inc on line 163.
warning: array_merge() [function.array-merge]: Argument #2 is not an array in .../sites/all/modules/emfield/contrib/emvideo/emvideo.module on line 584.

using drupal 6.20, cck 2.9 and todays' dev of Embedded Media Field

John Carbone’s picture

I have emfield installed and got this error after upgrading emfield and cck, then upgrading the link module and running update.php

Array_merge(): Argument #2 is not an array in /home/{removed}/public_html/{removed}/sites/all/modules/cck/content.install on line 43.
rothatboat’s picture

Subscribing

altbzh’s picture

Version: 6.x-2.4 » 6.x-2.5
Component: Embedded Video Field » Embedded Audio Field

J have the same warning : video works but not for audio.
I have Drupal 6x.20. My setting for PHP is PHP 5.3.

Thank you.

davidpauljunior’s picture

Same error here.

Probably related to this, it won't save any changes when I go to configure the field (under manage fields).
Wanted to change default size, but it just reverts it back when you save.

Tafa’s picture

i am in a similar situation as well as i have just updated the module onto my test website...
Any help would be more than appreciated...
Thanks
T

tescometro’s picture

Very much the same thing happening for me. again trying to configure the field results in default size input not being saved or applied.

Occurs with the same errors as above.

unc0nnected’s picture

Component: Embedded Audio Field » Embedded Video Field
Assigned: Unassigned » unc0nnected

I can also confirm this with Drupal 6.2 and the 6.x.25 of Embedded Video. It works, the new field holds however none of the settings configured for that field are saved

Exact same error messages as above

Tafa’s picture

okay, i hope i got it right. basically, i change line 163 to the following:

$columns = array_merge($columns, array(module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget)));

i then went on to change some of the settings on my content type where the embedded image field resided and saved. after saving, i got another error message along the lines of warning: Illegal offset type in isset or empty in ...
saved again and error went away...

hope that helps,
t

anrikun’s picture

@Tafa: a patch please :-)

Tafa’s picture

i'd rather leave the patch work to someone more experienced as:
a- i know little about patches, even though i am looking into it at the minute
b- i am unsure my fix does actually work given the existence of the warning it fires afterwards....
if you want to implement the change as i did, all that is required is for you to find the inc file which lione 163 is part of and change as mentioned above

hope that helps,
t

soulston’s picture

FileSize
621 bytes

Well here is a patch that resolves the array errors, but as Tafa points out a new error occurs for me in cck:

Illegal offset type in isset or empty in /sites/all/modules/contrib/cck/includes/content.crud.inc on line 444.

knigh7’s picture

sub

Anonymous’s picture

Subscribing. Same error :(

iaminawe’s picture

subscribing - same error

damiandab’s picture

subcribing - same problem :(

jrabeemer’s picture

Priority: Normal » Major

I get the same error. Bumping priority. This is a major bug in the 6.x-2.5 release.

green monkey’s picture

subcribing - same problem :(

itzcoatl’s picture

subscribing

green monkey’s picture

Update:

Perhaps this nothing to do with issue.

But I first saw this when I changed the thumbnail size to 200x150

ayalon’s picture

The error occurs, If you activate the Video Module without a Video Provider.

Solution:

Delete Any Video Fields on your Content Types
Deactivate all Modules of emfield
Uninstall all modules from emfield
Download Media Youtube Provider Module
Activate Media Youtube Module
Recreate your fcck video field: No more errors!

green monkey’s picture

Fatal error: Call to undefined function emfield_provider_menus() in /home/website.com/sites/all/modules/emfield/contrib/emvideo/emvideo.module on line 22

during uninstall

green monkey’s picture

update

seem to uninstall better - if I only uninstall the Video and YouTube and leave everything else install

jydrupal’s picture

getting same error:

array_merge() [function.array-merge]: Argument #2 is not an array in /home/content/17/6841317/html/modules/emfield/emfield.cck.inc on line 163.

what to do? please suggest

Vc Developer’s picture

subscribing!...

tivie’s picture

same issue.

warning: array_merge(): Argument #2 is not an array in /home/user/site/dev/sites/all/modules/emfield/emfield.cck.inc on line 163.
warning: array_merge(): Argument #1 is not an array in /home/user/site/dev/sites/all/modules/emfield/emfield.cck.inc on line 163.
warning: array_merge(): Argument #1 is not an array in /home/user/site/dev/sites/all/modules/emfield/emfield.cck.inc on line 163.
warning: array_merge(): Argument #2 is not an array in /home/user/site/dev/sites/all/modules/emfield/contrib/emvideo/emvideo.module on line 584.

followed the steps of uninstalling and installing and still, same issue.

iaminawe’s picture

Same here - uninstalled, reinstalled - recreated fields on content types , still same error

leewebdev’s picture

Nothing helpful to add, but I do want to report I'm experiencing the same error as displayed in #28. Will keep checking back here for a solution. Thanks.

thomasgm’s picture

Hello, i've fixed this changed the line on file emfield.cck.inc
Line 163:
$columns = array_merge($columns, module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget));

with this one:
$columns1 = array_merge($columns, array(module_invoke($module1, 'emfield_widget_settings_extra', 'save', $widget)))

Hope it helps someone.

thomasgm’s picture

The only problem is that if check the box "Required" on cck, even if you fill right the video infos it still says "Name of video field is required"

krisrobinson’s picture

Subscribing

Solution in #31 provides a new error:
warning: Illegal offset type in isset or empty in /sites/all/modules/cck/includes/content.crud.inc on line 444.

jydrupal’s picture

Did exactly what # 31 did and it fixed the problem but got the error that #33 has. I got error mentioned in # 33 while saving changes but it goes away if you save it AGAIN after going in and coming out of the form. Try if it works for you!

temelkoff’s picture

subcribing

Illegal offset type in isset or empty in /sites/all/modules/cck/includes/content.crud.inc on line 444.

nelsonbranco’s picture

Got the same problem as #3, any solutions yet?

anrikun’s picture

@unc0nnected: are you working on a patch to fix this bug?

damiandab’s picture

the same problems as #3

hihappycats’s picture

me too.

damiandab’s picture

Priority: Major » Critical

it's not possible to use this version of module. I can not even change/save configuration (example: width height of the player) in cck field settings :(

anrikun’s picture

Assigned: unc0nnected » Unassigned

@unc0nnected: if you are not working on a patch to fix this bug, don't assign this issue to you.

vaudaville’s picture

Reporting the same setup and problem as #3

narongwit12’s picture

subscribing

SchwebDesign’s picture

Yikes, i'm getting this error too using 6.x-2.5. I also have PHP 5.3.6. Is that perhaps the issue? Subscribing.

SchwebDesign’s picture

specifically, after attempting to add embedded video CCK field to a content type i get this:

    warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/familype/public_html/sites/all/modules/emfield/emfield.cck.inc on line 163.
    warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/familype/public_html/sites/all/modules/emfield/emfield.cck.inc on line 163.
    warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/familype/public_html/sites/all/modules/emfield/contrib/emvideo/emvideo.module on line 584.
    warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/familype/public_html/sites/all/modules/emfield/emfield.cck.inc on line 163.
    warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/familype/public_html/sites/all/modules/emfield/emfield.cck.inc on line 163.
    warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/familype/public_html/sites/all/modules/emfield/contrib/emvideo/emvideo.module on line 584.

and then this after attempting to save the following page:

    warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/familype/public_html/sites/all/modules/emfield/emfield.cck.inc on line 163.
    warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/familype/public_html/sites/all/modules/emfield/emfield.cck.inc on line 163.
    warning: array_merge() [function.array-merge]: Argument #2 is not an array in /home/familype/public_html/sites/all/modules/emfield/contrib/emvideo/emvideo.module on line 584.

and then it says "Added field Video."

i'll have to see if it still works somehow...

iamjon’s picture

I'm getting the same error. Experienced after having embeded video field, with youtube, afterwards wanted to add vimeo.

On uninstall I get this error:
Fatal error: Call to undefined function emfield_provider_menus() in /www/drupal6/sites/all/modules/emfield/contrib/emvideo/emvideo.module on line 22
Like #24...is it possible that not all the errors here are related?

Using the latest version of the module for 6.x not dev.

If anyone needs a quick workaround to uninstall, after uninstalling all the modules on line 34 of emvideo.module add

function emfield_provider_menus() {
return;
}

Then you can uninstall....but don't forget to get rid of it right after you uninstall cause it's a terrible quick and dirty hack.

heli0s’s picture

Today, I just installed the very latest stable release of Drupal 6, and this module. I started getting this error as well when I tried to create a content type; I only had one media type installed (youtube). So maintainers please listen up, this bug is NOT FIXED as someone earlier mentioned.

Looking at the code, I made a slight correction to get rid of the error. I also tried creating CCK content and didn't seem to have any issues as some others mentioned. Disclaimer: I didn't spend much time looking over the code (probably all of 5 minutes), so if this does not fix the underlying problem don't blame me.

My thought was perhaps the function module_invoke was not returning an array unless it had multiple items to return (ie. using just one or no media types). So, here is what I did if anyone is interested. :)

Starting around line 162, change the foreach block like so:

Change this:

      foreach (module_implements('emfield_widget_settings_extra') as $module) {
        $columns = array_merge($columns, module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget));
      }

To this:

      foreach (module_implements('emfield_widget_settings_extra') as $module) {

        $modinv = module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget);
        if (is_array($modinv)) {
                $columns = array_merge($columns, $modinv);
        } else {
                $columns = array_merge($columns, array($modinv));
        }
        //$columns = array_merge($columns, module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget));
      }
demonrage’s picture

#47 solution doesn't fix anything from my side. this is a serious problem, i even tried the latest dev version, updated, same error

Anonymous’s picture

I changed the following after which the save actions seemed to work:

line 160 in emfield.cck.inc
Original code:

    case 'save':
      $columns = array('providers');
      foreach (module_implements('emfield_widget_settings_extra') as $module) {
        $columns = array_merge($columns, module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget));
      }

Modified code:

    case 'save':
      $columns = array('providers');
      foreach (module_implements('emfield_widget_settings_extra') as $module) {
        $check = module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget);
        $invoked = (is_array($check) ? $check : array());
        $columns = array_merge($columns, $invoked);
      }

I no longer see the warnings and providers are saved as expected.

sjohnson’s picture

@Qubical - I registered just to thank you for this fix. A wonderfully timely and seemingly effective solution. No errors and my settings saved. Thanks!!!

aegagros’s picture

@Qubical - thanks for the fix. Same errors here on save and update, and no settings saved for video width and height. Fixed with #49.

demonrage’s picture

Really thanks dude,
Now my website can see the light again :)

peterbrunton’s picture

Code from post #49 also worked for me. Thanks Qubical

extensive’s picture

Post #49

Work for me!

Many many Thanks!

anrikun’s picture

@Qubical: please turn this into a patch. Thanks!

antiorario’s picture

Version: 6.x-2.5 » 6.x-2.x-dev
Status: Active » Needs review
FileSize
701 bytes

Since no one is providing a patch, here it is. It's the solution at #49, so credit goes to Qubical.

ilgriso’s picture

Solution at post #49 works also for me!
Thanks a lot!

ifrik’s picture

Applying the patch failed, but solution #49 works for me.

SchwebDesign’s picture

Patch from #56 worked for me as well http://drupal.org/node/398400#comment-4689226 I believe this is nearly identical to #49

galactus’s picture

#49 worked like a charm! Thanks Qubical! I was using the latest version Embed 2.5

tescometro’s picture

Thanks Qubical, your code @#49 fixed it for me too.

Macronomicus’s picture

#49 worked perfectly.

Cheers Qubical!

wmfinck’s picture

Strange, I installed emfield on "Site A" last week, and did NOT have this problem. Now today I install it on "Site B" and I DO have this problem. Both sites are on the same server, and the only difference is that "Site A" has MORE modules installed (OG) than "Site B" while all else is equal.

Then I remembered that on "Site A" I installed emfield LAST - after the CCK, Views, SWFTools and the other modules I install just about everywhere as standard for me. On "Site B" I installed emfield BEFORE Views & SWFTools (NOT before the CCK).

So before resorting to the patch above, I uninstalled all emfield modules, and reinstalled them (it is a new site with no data to worry about) and behold, the problems were gone, and no patch is necessary!

Of course, I am not knocking the patch - you will need it if you have data on your site that you do not want to lose. But perhaps the developers could see the problem a little clearer now, I hope.

BeaPower’s picture

#49 works for me!

Sk8erPeter’s picture

@Qubical in #49:

$invoked = (is_array($check) ? $check : array());

I think that's absolutely NOT correct! If it isn't an array, you just simply give back an EMPTY array?? Please tell me what sense it makes...

I think the correct solution is the following:

	$module_invoke = module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget);
	if( !is_array($module_invoke) ) $module_invoke = (array)$module_invoke;
	$columns = array_merge($columns, $module_invoke);

This way I cast $module_invoke variable to an array.

Anonymous’s picture

If it suits your needs that is fine and indeed it looks like a better way to handle it.
No need to "WTF" though, just your reply informing ppl of a better solution will be quite enough.

Sk8erPeter’s picture

OK, I edited my reply, but I didn't understand why people deify a really disputable solution. :)

tescometro’s picture

Deify? Are you just trolling? I'm sure people have simply expressed due gratitude for a working fix. And Qubical's solution is not disputable, it works completely without any known problem.

I for one have been very appreciative of Qubical's fix. It works both in terms of fixing the error, and allowing settings to be saved. Many others here have also been grateful for Q's fix, for me it was also particularly timely, allowing me to commit to using this module at a critical time in a project. I have, to date, had no known issues using it.

Your proposed "correct" solution (in reality of course there can be no single "correct" solution, though a better/different one is always possible of course.. ) is some 8 weeks later, and is as yet seemingly unconfirmed/untested in the field. You seem to have useful coding skills and vision, but no sense of tact or appreciation of others efforts. Everyone has different levels of skill or skill-base here. I appreciate you have removed the WTF, but now you choose to try insult the rest of us for our "deification" of his efforts? Displaying this amount of irritation at the praise Qubical has rightly received really isn't in the spirit of the Drupal community and I think you'll make yourself pretty unpopular in the long run with your approach. This would be a shame, as your contributions look like they could be very useful. Most modules and patches are provided completely free and with good grace here. Sure, many things are far from perfect, but there is generally a good vibe, and recognition of the time people have often spent helping others.

Out of interest, and quite seriously, as I'm still running with Qubical's fix, could anyone explain the potential consequences of its "incorrectness"?

SchwebDesign’s picture

well said. I'll second that question.

Anonymous’s picture

Thank you very much tescometro and SchwebDesign for your support of the spirit of the community.

Indeed tact is lacking slightly from his reply in my opinion but technically he is correct.
I can understand sk8terpeters' solution as this means that if the module returns a string or other data not being an array he converts it to an array and passes the value to the rest of the script.

My solution only fixes the missing array by placing an empty array into the script if the function call is not returning an array.

His solution indeed should be the better option as it keeps the data, if any was passed down by the function call. Otherwise it returns an empty array. I must admit I have not yet changed it myself as the project I was burning midnight oil for works as expected.

nnotario’s picture

#49 works for me also!

zeropx’s picture

Thanks Qubical,

This solution proved to work perfect.

muddie’s picture

Thanks from me too Qubical.
Saved my bacon.

fuzzyjared’s picture

I can confirm this is happening.
drupal 6.22
emfield 6.25

warning: array_merge() [function.array-merge]: Argument #2 is not an array in /sites/all/modules/contrib/emfield/emfield.cck.inc on line 163.
warning: array_merge() [function.array-merge]: Argument #2 is not an array in /sites/all/modules/contrib/emfield/contrib/emvideo/emvideo.module on line 584.

error triggered when adding cck field to content type.

After applying the patch / patch edit all appears to be working.

$module_invoke = module_invoke($module, 'emfield_widget_settings_extra', 'save', $widget);
if( !is_array($module_invoke) ) $module_invoke = (array)$module_invoke;
$columns = array_merge($columns, $module_invoke);

jerry’s picture

The patch in comment #49 with the modification in #65 worked for me as well.

dkingofpa’s picture

@Sk8erPeter, please provide a patch with your proposed solution. Thanks. How to create a patch: http://drupal.org/node/707484

brycesenz’s picture

Status: Needs review » Reviewed & tested by the community

subscribing, and confirming that the patch in #65 works for me.

Additionally, I'm setting this issue to "reviewed and tested by the community", as this solution seems to be solving the issue for several of us.

dale42’s picture

FileSize
757 bytes

Here is the patch in #49 updated per solution in #65.

Experiencing the errors with 6.x-2.5/Drupal 6.22. Apply the patch resolves them.

Sk8erPeter’s picture

@tescometro, #68 : I just saw your answer a "little bit" later. :) But I have to react just to clarify a few things, because I felt your answer unjust. OK, I admit that the word "deifying" could be a little bit insulting for someone so sensitive that it hurts his feelings :P, sorry - I didn't want to insult anyone.

But I wanted to clarify Qubical's fix is absolutely not so perfect, because it CAN cause unexpected errors IF module_invoke() function returns some kind of values that has to be saved and used later. That's why I checked if it's an array - if it's not, than it has to be casted not to get a warning message when using the array_merge() function. Qubical's solution simply ignores the return value if it's not an array. The code in his solution just checks its type, if it's an array, it saves its value, if not, it just simply creates an empty array. Maybe it doesn't cause any problems at all, because maybe in most cases this value isn't used in the module's given part later, but it's not excluded that this value could be useful in some cases. I hope you understand the "incorrectness" of the firstly provided patch.
I don't think I was so rude when posting my own patch that I could be excluded from Drupal community as you forecasted :D:D, and I didn't start using forums today, so I don't need a preaching like "dah dah, you were bad, shame on you, stand in the corner, you bastard", but thanks for calling my attention to take care of myself. :D And believe me, I wasn't "irritated" of Qubical's "praise", but possible mistakes that spread in Drupal community and can cause possible warnings or errors do annoy me, and I feel like I have to correct them if I know a possibly better solution, which maybe still isn't perfect - you can judge me for that. :) But you're right, we have to be more friendly to each other - this also applies to you! :P I hope everything is OK now, so peace!

@Qubical, #70 : thanks! :)

@dale42, #78 : thank you very much for making the patch, hope this will work without warnings.

Pete

tescometro’s picture

@Sk8erPeter I'm not going to argue the P's and Q's of bits of this. Instead will just say it nice you've replied this way. I agree with much you say, and applaud you for moving forward and commenting back here. Nice one. Thanks for leading to a better patch, and Peace!

sirian’s picture

Thanks Qubical for your path that saved me time.

amanda’s picture

Sigh.

We're having the same problem -- the module sets up fine but if we try to change any settings (the preview size, in particular) we get this array_merge() error and the change isn't saved.

duntuk’s picture

#49 works.

aaron’s picture

Status: Reviewed & tested by the community » Fixed

Thanks so much for the work on this issue. I tried installing the module with YouTube only, but I wasn't able to reproduce the error. However, with so many people reporting the error, and considering the code seemed innocuous enough, I have committed the fix. Note that I modified the patch slightly, simply typecasting the value as an array, saving us an extra couple of lines. Commit is at http://drupalcode.org/project/emfield.git/commitdiff/17bd36e?hp=f71633ba...

Status: Fixed » Closed (fixed)

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

purna_dey’s picture

#49 works.

_sparrow_’s picture

Status: Closed (fixed) » Needs work

I'm sorry, the issue is not fixed yet. I downloaded and installed the module an hour ago and as well got this warning. I applied the fix from #49 and all went alright.

I'm using 6.x-2.5.

zisser’s picture

Thanks!
That #23 worked for me.

zisser’s picture

Thanks!
Did the trick

the_g_bomb’s picture

Issue summary: View changes
Status: Needs work » Fixed

I can confirm that this is indeed fixed, the code is in 6.x-2.6.

Status: Fixed » Closed (fixed)

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