Hi, my new install of contemplate 7.x-1.0-alpha1 won't allow me to edit the template at all... I get this error. This is a new install of Drupal 7.0 release.

Warning: Parameter 1 to contemplate_edit_type_form() expected to be a reference, value given in drupal_retrieve_form() (line 771 of [..path to htdocs]/includes/form.inc).

Since I installed the module, I also get this error on visiting the homepage.

Warning: Parameter 1 to contemplate_node_view() expected to be a reference, value given in module_invoke_all() (line 817 of [...path to htdocs]/includes/module.inc).

I couldn't find anything in the issue queue already, can anyone help?

Thanks

CommentFileSizeAuthor
#8 1033908.patch616 bytestuongaz

Comments

linuxamartillazos’s picture

i have the same error. using drupal 7 when i try to edit a template:

Warning: Parameter 1 to contemplate_edit_type_form() expected to be a reference, value given en drupal_retrieve_form() (línea 771 de /var/www/raton/includes/form.inc).

commanderflash’s picture

Having the same issue here too. Could not find a solution.

21cdb’s picture

Same problem for me on Drupal 7.0. Are there any plans in future development? Coming from a WordPress background i thought CCK (Fields) and the possibilities for custom page templates were the strongth of Drupal 7. I'm pretty much surprised that there is no #D7AX on this module.

ther’s picture

Same problem

ther’s picture

If you remove reference signs (&) in line 142, as:

function contemplate_node_view($node, $build_mode) {

and line 242:

function contemplate_edit_type_form($form, &$form_state, $type = NULL) {

the warnings go away and the forms expected do appear. This seems like a hotfix, I don't know how this effects the functionality of the module, but it might as well just be a PHP security option I just got around.
Hope others will find this helpful.

linuxamartillazos’s picture

I've tried removing that & signs. Warnings disapear, but still can't load the templates. :-(

mynameispj’s picture

#5 worked for me. Templates load, warnings go away. Seems like a bizarre step to have to take, though.

tuongaz’s picture

StatusFileSize
new616 bytes

Just need to remove the reference & on the line 242 , so $form instead of &$form.

scottlozier’s picture

This patch works with PHP 5.2 but not 5.3. Removes Error, but does not load Contemplate. Anyone get this to work in PHP 5.3?

xog’s picture

Issue tags: +contemplate_node_view() reference warning

I have the same error:
Warning: Parameter 1 to contemplate_node_view() expected to be a reference, value given en module_invoke_all() (línea 817 de /..../includes/module.inc).

the php version is PHP 5.3.3-7
This errors appears when I migrate the web and now I have the latest version of php.

stmi’s picture

try to modify the module.inc
there seems to be an issue with passing by reference in call_user_func_array()
see: http://www.php.net/manual/en/function.call-user-func-array.php#91503
I just took the "hack" from this comment and put it in the module_invoke_all() function

replace the function module_invoke_all() with this:

function module_invoke_all() {
  $args = func_get_args();
  $hook = $args[0];
  unset($args[0]);
  $return = array();
  $Args = array(); 
  foreach($args as $k => &$arg){
            $Args[$k] = &$arg;
        }
  foreach (module_implements($hook) as $module) {
    $function = $module . '_' . $hook;
    if (function_exists($function)) {
      $result = call_user_func_array($function, $Args);
      if (isset($result) && is_array($result)) {
        $return = array_merge_recursive($return, $result);
      }
      elseif (isset($result)) {
        $return[] = $result;
      }
    }
  }

  return $return;
}
Draven_Caine’s picture

Fix #5 worked for me.

Edward Barend’s picture

#11 working great so far

dragonfighter’s picture

#11 worked for me too

dgtlmoon’s picture

Status: Active » Closed (fixed)

Appears to be fixed in current dev

8b14cb05 (James R Glasgow 2010-09-14 12:52:59 +0000 241) function contemplate_edit_type_form($form, &$form_state, $type = NULL) {

aftab470’s picture

i am upgrading statspro module for drupal 7 and i have the following error kindly help me out ......

Warning: Parameter 1 to statspro_overview_settings_form() expected to be a reference, value given in drupal_retrieve_form() (line 798 of E:\xampp\htdocs\drupal7\includes\form.inc).