warning: array_merge_recursive() [function.array-merge-recursive]: Argument #2 is not an array in .../includes/form.inc on line 1368.

Actually I dont know what module causes this error. Almost everything is working, but this error is on every page. On google a few webpages with the same error show up, but no-one has reported before, providing that error message.

It's about this line in /includes/form.inc:
$cache[$element_type] = array_merge_recursive($basic_defaults, $info);

Belonging to this sequence of coding:

/**
 * Retrieve the default properties for the defined element type.
 */
function _element_info($type, $refresh = NULL) {
  static $cache;

  $basic_defaults = array(
    '#description' => NULL,
    '#attributes' => array(),
    '#required' => FALSE,
    '#tree' => FALSE,
    '#parents' => array()
  );
  if (!isset($cache) || $refresh) {
    $cache = array();
    foreach (module_implements('elements') as $module) {
      $elements = module_invoke($module, 'elements');
      if (isset($elements) && is_array($elements)) {
        $cache = array_merge_recursive($cache, $elements);
      }
    }
    if (sizeof($cache)) {
      foreach ($cache as $element_type => $info) {
        $cache[$element_type] = array_merge_recursive($basic_defaults, $info);
      }
    }
  }

  return $cache[$type];
}

(Because it also states cache, I have to mention that I have rebuild the booster cache)

This is the second time I have this error in a few days, don't know how I got rid of it earlier and if it was under the exact same circumstances; now I don't get rid of that same error that easy.

It happened after problems with installing (the latest included) filefield; the site got unworkkable with another error that hasn't been resolved yet for some time:

* fatal error Cannot redeclare filefield_token_list
* Fatal error: Cannot redeclare filefield_token_list() (previously declared sites/all/module
* Cannot redeclare filefield_token_list()
(NOTE: I just did a first time new install a few days ago with the latest modules and I never upgraded like they're talking about a similar upgrade; never having that old module separate)

The after correcting the damage again by taking filefield (also file_aliases and filefield_paths) away and/or one of the modules components as alternative methods to get it working. But these experiments failed and the modules were rstored in their original order.

But the above mentioned error remained, while the site got working again; not anymore white screen with the message mentioned in the filefield problem links.

Now the filefield is with its original name in the modules dir, without causing this earlier major error. It is vinked and the place to vink it is darkened (while the neccessary Content(CCK) is enabled).

Earlier it couldn't be vinked without white screen + the first error message. But I found a trick; think I renamed filefield.module (as someone suggests in one of the links), then could 'install'/vink filefield and depending modules. Then renamed filefield.module back again. Or something like that...

= = = = = = = = = == = = = = = = = = = = = = = =

UPDATE:

But now I see that there are two files that end with .module:
filefield.module in the root and filefield_token.module in the filefield_token subdir.
So now I rename the later one (putting a dot "." in front).
=> error disappears, instead I get: "The content access permissions need to be rebuilt. Please visit this page."
admin/content/node-settings/rebuild (yes I copy here for the sake of all, because this is a secret setting; under normal circumstances unfindable).

OK! Rebuild 1 file or whatever => no more error message (none of the former two)

So now checking if some feature fails, because having disabled that .../modules/filefield/filefield_token/filefield_token.module ?

It could be an error by the developer that this file was only meant for upgrading from the 2.x to the 3.x series and not for a new install ?

3) Create a new file field in through CCK's interface. Visit Administer -> Content management -> Content types (admin/content/types), then click Manage fields on the type you want to add an file upload field. Select "File" as the field type and "File" as the widget type to create a new field.

=> yes it works!

Now should I rename the filefield_token.module back for some feature, or not?

= = = = = = = = = = = = = = = = = = = = = = = =

UPDATE 2:

renamed the .../modules/filefield/filefield_token.module back
=> no more error message !!! AND I can vink the filefield_token (subdir of filefield; I never had the old module!) in the modules list. =>

=> white screen +

Fatal error: Cannot redeclare filefield_token_list() (previously declared in .../sites/all/modules/filefield/filefield_token/filefield_token.module:7) in .../sites/all/modules/filefield/filefield.token.inc on line 29
line 29: $tokens['filefield-fid'] = $item['fid']; belonging to:

 * Implementation of hook_token_values():
 * Provide the concrete token values for a given file item.
 */
function filefield_token_values($type, $object = NULL) {
  if ($type == 'field') {
    $item = $object[0];
    $tokens['filefield-fid']                = $item['fid'];
    $tokens['filefield-description']        = $item['description'];
    $tokens['filefield-filename']           = $item['filename'];
    $tokens['filefield-filepath']           = $item['filepath'];
    $tokens['filefield-filemime']           = $item['filemime'];
    $tokens['filefield-filesize']           = $item['filesize'];
    $tokens['filefield-filesize_formatted'] = format_size($item['filesize']);
    $tokens['filefield-view']               = $item['view'];
    return $tokens;
  }
}

Only update.php is working => no updates available, but what the hack =>

warning: array_pop() [function.array-pop]: The argument should be an array in .../update.php on line 314.
The update process was aborted prematurely while running update # in .module. All errors have been logged. You may need to check the watchdog database table manually.

And then the same error (blank screen + fatal error:) on the whole site
line 314: list($module, $version) = array_pop(reset($_SESSION['updates_remaining'])); belonging to

  if ($_SESSION['update_success']) {
    $output = '<p>Updates were attempted. If you see no failures below, you may proceed happily to the <a href="'. base_path() .'?q=admin">administration pages</a>. Otherwise, you may need to update your database manually.'. $log_message .'</p>';
  }
  else {
    list($module, $version) = array_pop(reset($_SESSION['updates_remaining']));
    $output = '<p class="error">The update process was aborted prematurely while running <strong>update #'. $version .' in '. $module .'.module</strong>.'. $log_message;
    if (module_exists('dblog')) {
      $output .= ' You may need to check the "<"code">"watchdog"<"/code">" database table manually.';
    }
    $output .= '</p>';
  }

So ofcourse renamed filefield/filefield_token.module.inc again so that it stops working => white screen +

Fatal error: Call to undefined function filefield_paths_get_fields() in /home3/clearxst/public_html/mi-cr/sites/all/modules/file_aliases/file_aliases.module on line 118

lline 118: if (($ffp = filefield_paths_get_fields($node, $op)) == FALSE) { belonging to:

 * Implements hook_nodeapi().
 */
function file_aliases_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
  switch ($op) {
    case 'view':
      if (($ffp = filefield_paths_get_fields($node, $op)) == FALSE) {
        break;
      }

      $count = array();
      foreach ($ffp['#files'] as &$file) {
        if ($ffp['#settings'][$file['name']]['filealias']['display'] == TRUE) {
          $filefield_paths_alias = 'filefield_paths/alias/' . $file['field']['fid'];
          if (($alias = drupal_get_path_alias($filefield_paths_alias)) != $filefield_paths_alias) {
            // Calculate relative path.
            $path = (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PUBLIC) ? '' : '../../';
            if (empty($path)) {
              foreach (explode('/', file_directory_path()) as $dir) {
                $path .= '../';
              }
            }
            // Invoke file_aliases_hook_process().
            if (function_exists($function = 'file_aliases_' . $file['module'] . '_process')) {
              $function($node, $file, $path, $alias, $count);
            }
          }
        }
      }
      break;
  }
}

Admin pages however are still working. Cron.php no difference for white screen.
Flushing all the caches => same error message remains.

So let's visit that 'secret' page what I recorded:
admin/content/node-settings/rebuild
1 rebuild, but white screen error on normal site pages remains

Then I vinked filefiled_paths in modules => SITE BACK AGAIN.

but still filefield/filefield_token.module disabled by renaming.

Any idea?

(update 3 might follow for the next attempt)

Comments

quaze’s picture

philsward’s picture

Upgrading an old version of filefield, 3.2 to 3.6 created the same problem. I tried the rebuild but that didn't fix it... I didn't feel like diving into renaming the filefield_token.module so I instead decided to see if there was an installable filefield token module that had been created since I updated last (being out of the loop and all...) I didn't notice any filefield token module to install, but what I did notice was that imagefield was not checked (not enabled) whereas I knew it should be. (When I updated filefield, I also updated imagefield at the same time)

I had FUpload as a dependent module of imagefield so I disabled FUpload. After saving the page, I still noticed the error, but I also saw that ImageField was now enabled like it was supposed to be. So, I saved the page again and the error went away!

Anonymous’s picture

Thanks philsward; this fixed the problem!

wotaber’s picture

Thank you philsward for fixing the problem!

michaelfillier’s picture

Thanks to philsward I have resolved this issue too. What caused my problem was specific though. I was updating the site from a local dev version and while copying the new modules to the production server, filefield did not upload correctly. When I restored my site using backup_migrate I got a message that tole me filefield needs to be installed for imagefield to work and that imagefield was now disabled. After re-uploading filefield I started receiving the error that the OP mentioned, I went to the modules page and could no longer enable imagefield. I did what philsward suggested and by disabling image_FUpload imagefield became enabled again.