*  Notice: Undefined variable: user_role_alias in user_build_filter_query() (line 3206 of F:\xampplite\htdocs\drupal7\modules\user\user.module).
    * PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= '3')' at line 2: SELECT COUNT(u.uid) AS expression FROM {users} u INNER JOIN {users_roles} ur ON ur.uid = u.uid WHERE (u.uid <> :db_condition_placeholder_0) AND (.rid = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => 0 [:db_condition_placeholder_1] => 3 ) in PagerDefault->execute() (line 86 of F:\xampplite\htdocs\drupal7\includes\pager.inc).
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

tobiasb’s picture

FileSize
708 bytes
Stevel’s picture

Could you describe the steps I need to take to reproduce this bug? That helps a lot for testing the patch.

Damien Tournoud’s picture

Issue tags: +Needs tests
-      $user_roles_alias = $query->join('users_roles', 'ur', '%alias.uid = u.uid');
+      $user_role_alias = $query->join('users_roles', 'ur', '%alias.uid = u.uid');
       $query->condition($user_role_alias . '.rid' , $value);

The name of the table is 'users_roles', so the name of the variable should be $users_roles_alias.

Also, this needs tests.

Damien Tournoud’s picture

Status: Needs review » Needs work
tobiasb’s picture

@Stevel sure. go to people (admin/people), then filter by role (administrator).

mitchmac’s picture

Status: Needs work » Needs review
FileSize
1.85 KB

Tweak per #3 and test.

infojunkie’s picture

Status: Needs review » Reviewed & tested by the community

Reviewed and applied patch #6: success. Also undid patch for user.module and applied new test: failure.

Dries’s picture

I think this looks good but ideally, UserAdminTestCase would be refactored a bit. This patch sort of slaps a test case onto the existing class without looking at what is there. I think UserAdminTestCase could be tidied up a little.

webchick’s picture

Status: Reviewed & tested by the community » Needs work

Hm. Yeah, it looks like testUserAdmin() does at least partial testing of this admin page, so this test could likely go into there with the rest.

Dries, was there some specific refactoring you were looking for? Or just unifying the related test cases into one function?

ericduran’s picture

Status: Needs work » Needs review
FileSize
3.28 KB

I change user_role_alias to users_role_alias in both case not just the elseif. I also implement the role testing in the testUserAdmin function.

moshe weitzman’s picture

Status: Needs review » Reviewed & tested by the community

hopefully this is what dries had in mind. its fixed, and its a critical.

webchick’s picture

Status: Reviewed & tested by the community » Fixed

Yeah, this looks good to me apart from some minor formatting things. I took care of those before commit.

Committed to HEAD. Great work! :)

Status: Fixed » Closed (fixed)
Issue tags: -Needs tests

Automatically closed -- issue fixed for 2 weeks with no activity.