Skip to content
Snippets Groups Projects
Commit b1026a1a authored by Angie Byron's avatar Angie Byron
Browse files

#776178 follow-up by David_Rothstein: Fixed PHP 5.3 warning for command line...

#776178 follow-up by David_Rothstein: Fixed PHP 5.3 warning for command line install at the root, rather than the symptom.
parent 57fe6927
No related branches found
No related tags found
No related merge requests found
...@@ -459,7 +459,20 @@ function form_state_keys_no_cache() { ...@@ -459,7 +459,20 @@ function form_state_keys_no_cache() {
* Any additional arguments are passed on to the functions called by * Any additional arguments are passed on to the functions called by
* drupal_form_submit(), including the unique form constructor function. * drupal_form_submit(), including the unique form constructor function.
* For example, the node_edit form requires that a node object be passed * For example, the node_edit form requires that a node object be passed
* in here when it is called. * in here when it is called. Arguments that need to be passed by reference
* should not be included here, but rather placed directly in the $form_state
* build info array so that the reference can be preserved. For example, a
* form builder function with the following signature:
* @code
* function mymodule_form($form, &$form_state, &$object) {
* }
* @endcode
* would be called via drupal_form_submit() as follows:
* @code
* $form_state['values'] = $my_form_values;
* $form_state['build_info']['args'] = array(&$object);
* drupal_form_submit('mymodule_form', $form_state);
* @endcode
* For example: * For example:
* @code * @code
* // register a new user * // register a new user
......
...@@ -406,8 +406,14 @@ function install_run_task($task, &$install_state) { ...@@ -406,8 +406,14 @@ function install_run_task($task, &$install_state) {
// For non-interactive forms, submit the form programmatically with the // For non-interactive forms, submit the form programmatically with the
// values taken from the installation state. Throw an exception if any // values taken from the installation state. Throw an exception if any
// errors were encountered. // errors were encountered.
$form_state = array('values' => !empty($install_state['forms'][$function]) ? $install_state['forms'][$function] : array()); $form_state = array(
drupal_form_submit($function, $form_state, $install_state); 'values' => !empty($install_state['forms'][$function]) ? $install_state['forms'][$function] : array(),
// We need to pass $install_state by reference in order for forms to
// modify it, since the form API will use it in call_user_func_array(),
// which requires that referenced variables be passed explicitly.
'build_info' => array('args' => array(&$install_state)),
);
drupal_form_submit($function, $form_state);
$errors = form_get_errors(); $errors = form_get_errors();
if (!empty($errors)) { if (!empty($errors)) {
throw new Exception(implode("\n", $errors)); throw new Exception(implode("\n", $errors));
...@@ -1392,7 +1398,7 @@ function install_import_locales(&$install_state) { ...@@ -1392,7 +1398,7 @@ function install_import_locales(&$install_state) {
* @return * @return
* The form API definition for the site configuration form. * The form API definition for the site configuration form.
*/ */
function install_configure_form($form, &$form_state, $install_state) { function install_configure_form($form, &$form_state, &$install_state) {
if (variable_get('site_name', FALSE) || variable_get('site_mail', FALSE)) { if (variable_get('site_name', FALSE) || variable_get('site_mail', FALSE)) {
// Site already configured: This should never happen, means re-running the // Site already configured: This should never happen, means re-running the
// installer, possibly by an attacker after the 'install_task' variable got // installer, possibly by an attacker after the 'install_task' variable got
...@@ -1583,7 +1589,7 @@ function install_check_requirements($install_state) { ...@@ -1583,7 +1589,7 @@ function install_check_requirements($install_state) {
/** /**
* Forms API array definition for site configuration. * Forms API array definition for site configuration.
*/ */
function _install_configure_form($form, &$form_state, $install_state) { function _install_configure_form($form, &$form_state, &$install_state) {
include_once DRUPAL_ROOT . '/includes/locale.inc'; include_once DRUPAL_ROOT . '/includes/locale.inc';
$form['site_information'] = array( $form['site_information'] = array(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment