We have a site that is throwing errors when uploading files to a simple "Page" node. I've done a lot of work trying to track down the actual source of the error, and I posted a half dozen messages to various likely threads at drupal.org.

The errors we get on file attach/upload:

warning: Parameter 2 to wysiwyg_form_alter() expected to be a reference, value given in /var/www/drupal/includes/common.inc on line 2892.

warning: Parameter 2 to simple_access_form_alter() expected to be a reference, value given in /var/www/drupal/includes/common.inc on line 2892.

I understand about passing by reference versus value. I understand about fixing the problem in the offending module by using the two calls to drupal_alter(), as described on http://drupal.org/node/930992#comment-4066840, but so far I have not been able to find what module is making the call incorrectly.

I tried installing and enabling the same set of modules on a test site but cannot reproduce these errors.

It's hard to post a bug report when you don't know the offending module.

See also http://drupal.org/node/1200970#comment-5463436.

2 Answers 2


Assuming you do not have a debugger going (getting XDebug to run for your local development environment is probably the single most useful thing you can do the entire year), you could use debug_backtrace() at the place of the error (i.e. in the two form alter functions) to find out what is calling them. If you shoot its output into watchdog(), hopefully you can cross reference the time of the error with a particular invocation of these functions. Do be aware that these are form alter hooks, which get called for each and every form Drupal is building (and you might be surprised there can actually be several forms on a single page; just think of search and login forms). I.e. not every call will be the offending one.

  • I had already placed a dsm(debug_backtrace()); at the beginning of the wysiwyg_form_alter function. It showed the following: [0] wysiwyg_form_alter [1] call_user_func_array from common.inc (core) [2] drupal_alter from form.inc (core) [3] drupal_prepare_form from form.inc (core) [4] drupal_get_form (from node.pages.inc, core) [5] node_page_edit [6] call_user_func_array (menu.inc) [7] menu_execute_active_handler (index.php)
    – user5035
    Commented Jan 18, 2012 at 15:22
  • Not sure where to go from here, since it seems to be all core stuff, and I thought core was OK with php 5.3.
    – user5035
    Commented Jan 18, 2012 at 15:29
  • It should be, but core can have bugs just like any other piece of software :) I do find a few issues on D.o about your error message (specifically, code going through common.inc line 2892 throwing this error), but there doesn't seem to be a clear cut solution yet.
    – Eelke Blok
    Commented Jan 19, 2012 at 19:12
  • Thanks for the hint - I applied a patch to common.inc as described in the comment below, and that fixed the problem. I also along the way (in response to other error messages and problems) patched the core upload.module and applied two patches to the private_upload module. Whew! Fixing common.inc based on: drupal.org/node/710892#comment-3884210 Thanks for your help Eelke Blok!!
    – user5035
    Commented Jan 19, 2012 at 22:09

The errors reported are for functions contained, respectively, in the Wysiwyg module and the Simple Access module. wysiwyg_form_alter() is the implementation of hook_form_alter() done from the first module, and simple_access_form_alter() is the implementation of the same hook done from the second module.

The function names of function implemented from a module are generally prefixed by the short name of the module. In the case of hook implementations, the list of the hooks used by Drupal is listed under Hooks (Drupal 7) and Hooks (Drupal 6); that helps because the hook name is the second part of the hook implementation.

For example, wysiwyg_form_alter() could be the function implemented by a module using "wysiwyg_form" as short name, but looking at the installed modules, you will see that you don't have any "wysiwyg_form.module" file; instead, you have a "wysiwyg.module" file that is generally inside a "wysiwyg" directory.

Not the answer you're looking for? Browse other questions tagged or ask your own question.