warning: Parameter 2 to content_copy_form_alter() expected to be a reference, value given in C:\xampplite\htdocs\mytest\includes\common.inc on line 2829.
warning: Parameter 2 to date_form_alter() expected to be a reference, value given in C:\xampplite\htdocs\mytest\includes\common.inc on line 2829.
warning: Parameter 2 to date_timezone_form_alter() expected to be a reference, value given in C:\xampplite\htdocs\mytest\includes\common.inc on line 2829.

Hello, I have this problem with PHP 5.3.1 (XAMPP Lite 1.7.3)

It appears when I push the button to create new values in a CCK field with unlimited possible values.
I think that it's again a problem with the ampersand, isn't it?

Any suggestions?

Thanks

Comments

mentitude’s picture

I have a similar problem:

warning: Parameter 2 to taxonomy_treemenu_menu_link_alter() expected to be a reference, value given in C:\wamp\www\drupal-6.15\includes\common.inc on line 2829.

this repeats a lot when I make changes to content structure.

Cron does not appear to be working also.

Im using Drupal 6.15, php 5.3.0 and am building a site on wampserver.

Solutions would be greatly appreciated

shambler’s picture

I too have got this error when clicking on 'Add another item' on a field item with unlimited items. What's the solution?

I am running 6.15 and php 5.3.0 so I guess the php is the problem.

shambler’s picture

2827 foreach (module_implements($type .'_alter') as $module) {
2828 $function = $module .'_'. $type .'_alter';
2829 call_user_func_array($function, $args);
2830 }
2831 }

Is there a simple change we can make to line 2829?

cochranrg’s picture

I am trying to use the core upload module to allow users to upload XLS files etc. But, every time I try to upload a file I get this error:

warning: Parameter 2 to date_form_alter() expected to be a reference, value given in ..\includes\common.inc on line 2829.

HELP!

RC

cochranrg’s picture

I since removed the Date API and all other CCK date items from administration and this error has gone away. I am still having upload/download issues but they are not related to this.

cesarkohl’s picture

Same problem here but for content copy, fivestar, userprotect and comment notify modules:

# warning: Parameter 2 to content_copy_form_alter() expected to be a reference, value given in C:\Arquivos de Programas\wamp\www\drupal-6.15\includes\common.inc on line 2829.
# warning: Parameter 2 to fivestar_form_alter() expected to be a reference, value given in C:\Arquivos de Programas\wamp\www\drupal-6.15\includes\common.inc on line 2829.
# warning: Parameter 2 to fivestar_comment_form_alter() expected to be a reference, value given in C:\Arquivos de Programas\wamp\www\drupal-6.15\includes\common.inc on line 2829.
# warning: Parameter 2 to userprotect_form_alter() expected to be a reference, value given in C:\Arquivos de Programas\wamp\www\drupal-6.15\includes\common.inc on line 2829.
# warning: Parameter 2 to comment_notify_form_alter() expected to be a reference, value given in C:\Arquivos de Programas\wamp\www\drupal-6.15\includes\common.inc on line 2829

cesarkohl’s picture

Again, it's teh ampersand.

All you need to do is to find the related function and delete two ampersands. I don't know why, but I saw a lot of pro ppl doing this and solving almost the same problem.

Example:

# warning: Parameter 2 to content_copy_form_alter() expected to be a reference, value given in C:\Arquivos de Programas\wamp\www\drupal-6.15\includes\common.inc on line 2829.

1. find where's content_copy_form_alter()
2. it's here! /cck/modules/content_copy/content_copy.module
3. open and find the function content_copy_form_alter(). It's like that:
function content_copy_form_alter(&$form, &$form_state, $form_id)
4. delete the two ampersands
function content_copy_form_alter($form, $form_state, $form_id)

And that's it!

ps: Look for the .module archive in the root of the related module folder.

humanoc’s picture

Thanks for the reply.

I have to say that, despite of the warning, the functionality is correct.

josepvalls’s picture

I'm having the same error.
I just migrated my website to a new machine with Wamp.
It used to work perfectly with Xampp, but now I get similar messages all around and many functionalities are broken.
I don't think removing the ampersands is the solution. I'm getting Nulls and ´0´ where objects were expected.

thex2003’s picture

thank for your help.

b3liev3’s picture

I have the same problem with

# warning: Parameter 2 to content_copy_form_alter() expected to be a reference, value given in includes/common.inc on line 2829.
# warning: Parameter 2 to date_form_alter() expected to be a reference, value given in includes/common.inc on line 2829.
# warning: Parameter 2 to date_timezone_form_alter() expected to be a reference, value given in includes/common.inc on line 2829.
# warning: Parameter 2 to i18nmenu_form_alter() expected to be a reference, value given in includes/common.inc on line 2829.
# warning: Parameter 2 to wysiwyg_form_alter() expected to be a reference, value given in includes/common.inc on line 2829.

Date and Calendar already gave me problems with PHP 5.3

I'll do the removing thing, but I would love to see a patch. I never like having to change modules.

josepvalls’s picture

Meanwhile, you could just switch your PHP version.
http://drupal.org/node/525856#comment-1967458

francisconi.org’s picture

this is the message I gave intentaga error when upload photos

* warning: Parameter 2 to content_copy_form_alter() expected to be a reference, value given in /var/www/tubisuteria.com.ve/includes/common.inc on line 2839.
* warning: Parameter 2 to uc_product_form_alter() expected to be a reference, value given in /var/www/tubisuteria.com.ve/includes/common.inc on line 2839.
* warning: Parameter 2 to uc_product_kit_form_alter() expected to be a reference, value given in /var/www/tubisuteria.com.ve/includes/common.inc on line 2839.
* warning: Parameter 2 to uc_store_form_alter() expected to be a reference, value given in /var/www/tubisuteria.com.ve/includes/common.inc on line 2839.
* warning: Parameter 2 to wysiwyg_form_alter() expected to be a reference, value given in /var/www/tubisuteria.com.ve/includes/common.inc on line 2839.
* warning: Parameter 2 to xmlsitemap_form_alter() expected to be a reference, value given in /var/www/tubisuteria.com.ve/includes/common.inc on line 2839.
* warning: Parameter 2 to xmlsitemap_node_form_alter() expected to be a reference, value given in /var/www/tubisuteria.com.ve/includes/common.inc on line 2839.
* warning: Parameter 2 to nodewords_form_alter() expected to be a reference, value given in /var/www/tubisuteria.com.ve/includes/common.inc on line 2839.
* warning: Parameter 2 to nodewords_nodetype_form_alter() expected to be a reference, value given in /var/www/tubisuteria.com.ve/includes/common.inc on line 2839.

and advice sgiendo Mr. cesarkohl
make the following changes and fix me

-------------------------------------------------------------------------
sites/all/modules/cck/modules/content_copy/content_copy.module
line 503
function content_copy_form_alter(&$form, &$form_state, $form_id) {
for
function content_copy_form_alter($form, $form_state, $form_id) {
--------------------------
sites/all/modules/ubercart/uc_attribute/uc_attribute.module
line 278
function uc_attribute_form_alter(&$form, &$form_state, $form_id) {
for
function uc_attribute_form_alter(&$form, &$form_state, $form_id) {
--------------------------------------------------------------------
sites/all/modules/ubercart/uc_catalog/uc_catalog.module
line 345
function uc_catalog_form_alter(&$form, &$form_state, $form_id) {
for
function uc_catalog_form_alter($form, $form_state, $form_id) {
-----------------------------------------------------------------
sites/all/modules/ubercart/uc_product/uc_product.module
line 819
function uc_product_form_alter(&$form, &$form_state, $form_id) {
for
function uc_product_form_alter($form, $form_state, $form_id) {
-----------------------------------------------------------------
sites/all/modules/ubercart/uc_product_kit/uc_product_kit.module
line 101
function uc_product_kit_form_alter(&$form, &$form_state, $form_id) {
for
function uc_product_kit_form_alter($form, $form_state, $form_id) {
-----------------------------------------------------------------
sites/all/modules/ubercart/uc_store/uc_store.module
line 573
function uc_store_form_alter(&$form, &$form_state, $form_id) {
for
function uc_store_form_alter(&$form, &$form_state, $form_id) {
-----------------------------------------------------------------
sites/all/modules/xmlsitemap/xmlsitemap.module
line 70
function xmlsitemap_form_alter(&$form, &$form_state, $form_id) {
for
function xmlsitemap_form_alter($form, $form_state, $form_id) {
-----------------------------------------------------------------
sites/all/modules/xmlsitemap/xmlsitemap_node/xmlsitemap_node.module
line 103
function xmlsitemap_node_form_alter(&$form, &$form_state, $form_id) {
for
function xmlsitemap_node_form_alter($form, $form_state, $form_id) {
-----------------------------------------------------------------
sites/all/modules/nodewords/nodewords.module
line 74
function nodewords_form_alter(&$form, &$form_state, $form_id) {
for
function nodewords_form_alter($form, $form_state, $form_id) {
-----------------------------------------------------------------
sites/all/modules/nodewords_nodetype/nodewords_nodetype.module
line 7
function nodewords_nodetype_form_alter(&$form, &$form_state, $form_id) {
for
function nodewords_nodetype_form_alter($form, $form_state, $form_id) {
-----------------------------------------------------------------

pardon my English (not English)

b3liev3’s picture

gillypots’s picture

Also getting errors when I try to upload a picture in a newly created content type, also using Only local images are allowed. is not working, just shows as a broken image icon.

* warning: Parameter 2 to content_copy_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to fivestar_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to taxonomy_image_blocks_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to taxonomy_image_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to uc_payment_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to uc_paypal_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to uc_flatrate_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to uc_quote_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to uc_attribute_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to uc_catalog_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to uc_file_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to uc_product_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to uc_product_kit_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to uc_store_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.
* warning: Parameter 2 to uc_taxes_form_alter() expected to be a reference, value given in C:\xampp\htdocs\carnoobatest2\includes\common.inc on line 2839.

this is line 2839 from the includes\common.inc - call_user_func_array($function, $args);

Any help would be highly appreciated.
Many Thanks

Kauto’s picture

You can try this ugly hack:
replace line 2829 in \includes\common.inc

call_user_func_array($function, $args);

with

$args_ref = array();
foreach($args as $k => &$arg){
$args_ref[$k] = &$arg;
}
call_user_func_array($function, $args_ref);

See Ya There’s picture

It solved my problem
Thanks Kauto

Spoke to soon.

This does solve the problem as long as an authenticated user is logged in but the problem remains the same if an Anonymous user visits our site.

blajay’s picture

Post by b3liev3 describes the solution (patch) that worked for me - I had the same problem using PHP5.3. I got the error below when trying to "add another item" using CCK fields:

* warning: Parameter 2 to wysiwyg_form_alter() expected to be a reference, value given in /customers/..../httpd.www/drupal/includes/common.inc on line 2839.
* warning: Parameter 2 to mollom_form_alter() expected to be a reference, value given in /customers/..../httpd.www/drupal/includes/common.inc on line 2839

Anyone having this problem should read http://drupal.org/node/705512

It seems to be a CCK problem rather than a problem with the includes/common.inc

Blajay

ceege111’s picture

Worked for me, the patch did not, thanks Kauto

(Ubuntu 10.04)

hobocta’s picture

Thank you, Kauto.
It works.

skclewis’s picture

THANK YOU KAUTO!!! I had the same problem listing about 20 or so different modules. I installed your "ugly hack" and they all disappeared. So your "ugly hack" ain't so ugly. :)

Your hack saved me a major headache on a current project. This issue really needs to be addressed by someone working with Drupal.core and PHP 5.3. Us poor developers shouldn't have to go through this pain when creating websites.

Thanks again for an excellent solution!!

jaspm2004’s picture

that would do!!! thanks

kambey’s picture

Many thanks as i googled full day before come into this and solved the problem. Have a beer!

peternickson’s picture

This message appears twice when I push button to attach a new file.

warning: Parameter 2 to content_copy_form_alter() expected to be a reference, value given in C:\xampp\htdocs\drupal\includes\common.inc on line 2839.

line 2839 instead of 2829

rnexussix’s picture

The error messages go away once I turn off CCK module. I'm trying to run Drupal on Ubuntu 10.04 LTS.

Will there be a version of CCK that is compatible with PHP version that is used in all the latest distributions ?

senthilmohith’s picture

thank u very much Kauto .........

herveh’s picture

Thanks Kauto
I have been trying to apply some patch
see : http://drupal.org/node/705512
but i still had the same errors
would love to have a permanent fix to this issue

bitsgrecco’s picture

When using the 'Add more' button, the problem origins in the way CCK calls 'common.inc#drupal_alter(...)' to fire notifications to hook_form_alter.
Both problem and solution are documented into 'common.inc#drupal_alter(...)', since function func_get_args (used to have flexible number of params for drupal_alter) always returns params by value. So, we can only receive a single by-ref param (&$data), but signature of 'hook_form_alter' takes 2 by-ref args!!!

See common.inc#drupal_alter(...)

Fix have to be aplied to file 'modules/cck/includes/content.node_form.inc'.
Calls to drupal_alter from CCK need to put $form_state's reference into $form_element['__drupal_alter_by_ref'] before being done, and without that empty array passed as empty param!

These are the diff changes:

[modules/cck/includes/content.node_form.inc]
325--- drupal_alter('form', $form_element, array(), 'content_add_more_js');
325+++ $form_element['__drupal_alter_by_ref'] = array(&$form_state);
326+++ drupal_alter('form', $form_element, 'content_add_more_js');

mandreato’s picture

Shouldn't be issued as bug fix to include in the next D6.x release ?

arleytriana’s picture

Thank I save my time, you are a good professional.

toutanne’s picture

thanks it works !!!!

zyxware’s picture

I had similar issue.
I used to have this issue
warning: Parameter 2 to uc_signup_form_alter() expected to be a reference, value given in includes/common.inc on line 2883.
I was using php 5.3 and drupal 6.19. This i got solution for this issue from
http://drupal.org/node/710892#comment-2836432
Using this I have created a patch for the issue.

Now I have updated the core the same issue started to show at line number 2892.
warning: Parameter 2 expected to be a reference, value given in includes/common.inc on line 2892.
I have used the same method for drupal 6.20. Patch code is given below.

--- common.inc	2010-12-16 02:41:22.000000000 +0530
+++ includes/common.inc	2010-12-31 11:00:06.021749138 +0530
@@ -2887,9 +2887,13 @@
   array_shift($additional_args);
   $args = array_merge($args, $additional_args);
 
+  $args_ref = array();
+  foreach($args as $k => &$arg){
+    $args_ref[$k] = &$arg;
+  }
   foreach (module_implements($type .'_alter') as $module) {
     $function = $module .'_'. $type .'_alter';
-    call_user_func_array($function, $args);
+    call_user_func_array($function, $args_ref);
   }
 }
godling’s picture

many thanks for your solution

skclewis’s picture

Tried your patch by including your lines into common.inc. I got a whole set of different error messages. However when I applied on Kauto's ugly hack things work fine. See http://drupal.org/node/710892#comment-4796132 for details.

un11imig’s picture

I use the last CCK version and this not solves the problem. Your pach works like a charm. Thanks.

kamranzafar’s picture

Thanks it worked for me.

W.M.’s picture

It looks like this issue is now resolved in the latest official release of CCK. No need to down-grade to earlier versions of PHP.

eric.chenchao’s picture

It seems the problem of drupal_alter in upload module. Read this article

http://drupal.org/node/925580

http://drupal.org/node/705512#comment-4050074

husztisanyi’s picture

I switch off some modules and found, that 'One page profile' module made this error. "warning: Parameter 2 to content_copy_form_alter() expected to be a reference, value given in .\includes\common.inc on line 2829."

ressa’s picture

I updated CCK to the latest dev version (6.x-3.x-dev) from 2011-Mar-18, and the error messages are gone. Not everybody would want to use the dev version, but I need the multigroup feature.

un11imig’s picture

This not works for me, the patch presented by Kauto and adapted by zyxware works like a charm.

chinita7’s picture

Looks like my problem had been caused by one page profile module. When I updated it to the latest version all the errors are gone. The issue about PHP 5.3 incompatibly for one page profile is here.
I'm using CCK 6.x-2.9 without applying the patch to core above.

memcinto’s picture

chinita7, how did you determine which module was actually causing the problem? That's what I'm having trouble with. Thanks.

chinita7’s picture

I actually just happened to find out when I disabled it. Disabling modules one by one is the only way I know..

memcinto’s picture

Thanks chinita7. I actually applied to patch to common.inc as described above, and that fixed my problem.