Example profile is totally wrong for Drupal 7

Created on 23 May 2011, almost 14 years ago
Updated 11 March 2023, about 2 years ago

API page: http://api.drupal.org/api/drupal/developer--example.profile/function/exa...

Describe the problem you have found:
It appears that the function signature should be

example_form($form, &$form_state) { ... }

I found while running PHP 5.3.2 that the current signature throws the following warning:

<em>Warning:</em> Parameter 1 to MODULE_form_settings() expected to be a reference, value given in drupal_retrieve_form() (line 771 of /PATH/TO/WEBROOT/includes/form.inc).

Line 755 appears to merge a non-referenced variable in the 0 position of the $args array.

/includes/file.inc

751   $form = array();
752   // We need to pass $form_state by reference in order for forms to modify it,
753   // since call_user_func_array() requires that referenced variables are passed
754   // explicitly.
755   $args = array_merge(array($form, &$form_state), $args);
756
757   // When the passed $form_state (not using drupal_get_form()) defines a
758   // 'wrapper_callback', then it requests to invoke a separate (wrapping) form
759   // builder function to pre-populate the $form array with form elements, which
760   // the actual form builder function ($callback) expects. This allows for
761   // pre-populating a form with common elements for certain forms, such as
762   // back/next/save buttons in multi-step form wizards. See drupal_build_form().
763   if (isset($form_state['wrapper_callback']) && function_exists($form_state['wrapper_callback'])) {
764     $form = call_user_func_array($form_state['wrapper_callback'], $args);
765     // Put the prepopulated $form into $args.
766     $args[0] = $form;
767   }
768
769   // If $callback was returned by a hook_forms() implementation, call it.
770   // Otherwise, call the function named after the form id.
771   $form = call_user_func_array(isset($callback) ? $callback : $form_id, $args);
772   $form['#form_id'] = $form_id;
773
774   return $form;
775 }
🐛 Bug report
Status

Needs work

Component

API documentation files

Created by

🇺🇸United States KeyboardCowboy Denver, CO, USA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024