Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
I can confirm this and can also add that the problem occurs in the section of code in user.module:
function user_admin() {
$edit = isset($_POST['edit']) ? $_POST['edit'] : '';
$op = isset($_POST['op']) ? $_POST['op'] : '';
if (empty($op)) {
$op = arg(2);
}
switch ($op) {
case 'search':
case t('Search'):
$output = search_form(url('admin/user/search'), $_POST['edit']['keys'], 'user') . search_data($_POST['edit']['keys'], 'user');
break;
case t('Create new account'):
case 'create':
$output = user_register();
break;
default:
$output = user_admin_account();
}
return $output;
}
In this code, the call to search_data() should return the themed search results, however, the call to search_form() on the same line results in a call to drupal_get_form():
I have verified, w/ print statements, that the call to drupal_get_form() results in the execution of the drupal_goto() at the very end of drupal_get_form(). This, in turn, forces a redirect which caues $_POST[] to lose its values. Not sure what the exact cause is. The problem doesn't occur in the search form at q=search, because the drupal_goto() includes the search terms as a $_GET[] variable appended to the URL. In short, because of the drupal_goto(), there are no values set in $_POST[]. So, the code executes again and an unset $_POST['edit']['keys'] value is passed to the search_data() call in user_admin(). That's why there're no search results and a blank search form.
drupal_get_form() is a maze of code I couldn't follow this late into the night, but it is defined in form.inc.
Comments
Comment #1
ankur commentedI can confirm this and can also add that the problem occurs in the section of code in user.module:
In this code, the call to search_data() should return the themed search results, however, the call to search_form() on the same line results in a call to drupal_get_form():
I have verified, w/ print statements, that the call to drupal_get_form() results in the execution of the drupal_goto() at the very end of drupal_get_form(). This, in turn, forces a redirect which caues $_POST[] to lose its values. Not sure what the exact cause is. The problem doesn't occur in the search form at q=search, because the drupal_goto() includes the search terms as a $_GET[] variable appended to the URL. In short, because of the drupal_goto(), there are no values set in $_POST[]. So, the code executes again and an unset $_POST['edit']['keys'] value is passed to the search_data() call in user_admin(). That's why there're no search results and a blank search form.
drupal_get_form() is a maze of code I couldn't follow this late into the night, but it is defined in form.inc.
Comment #2
chx commentedhttp://drupal.org/node/49799