Closed Bug 429793 Opened 16 years ago Closed 16 years ago

Bug in get_permissions causes all pages to break after cache clear

Categories

(support.mozilla.org :: Knowledge Base Software, task)

task
Not set
blocker

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: oremj, Assigned: clouserw)

References

()

Details

(Whiteboard: sumo_only)

Attachments

(1 file)

When this function is called:

tiki-setup_base.php Line 461:

        $allperms = $userlib->get_permissions(0, -1, 'permName_desc', '', '');

lib/userslib.php Line 1702:

        if ($type) { <- $type is '' 
            $mid = ' where `type`= ? ';
            $values[] = $type;
        } else { <- runs this code
            // Mozilla opt: this index is not getting used 
            // (and it should be; otherwise the order by uses filesort
            $mid = ' force index (permName) '; <- this sets up $mid
        }


            if ($mid) { <- $mid is set above or true
                $mid .= " and `permName` > ''"; <- $mid appends this
            } else { 
                $mid .= " where `permName` > ''";
            }

Code ends up generating this query:

select * from `users_permissions` force index (permName) and `permName` > '' order by `permName` desc;

Which of course is invalid and ends up displaying an error on the front page.
OS: Mac OS X → All
Hardware: PC → All
Running svn blame it looks like the bug was introduced in revision 12313:

 12313 lthomson@mozilla.com     } else {
 12313 lthomson@mozilla.com             // Mozilla opt: this index is not getting used 
 12313 lthomson@mozilla.com             // (and it should be; otherwise the order by uses filesort
 12313 lthomson@mozilla.com             $mid = ' force index (permName) ';
 12313 lthomson@mozilla.com         }
OS: All → Mac OS X
Hardware: All → PC
Attached patch fix problemSplinter Review
Sounds like the problem is we're putting stuff in $mid.  Instead of overloading $mid, this patch adds a $bonus to the query.
Assignee: nobody → clouserw
Status: NEW → ASSIGNED
Attachment #316547 - Flags: review?(oremj)
Comment on attachment 316547 [details] [diff] [review]
fix problem

Looks like that would fix the problem.
Attachment #316547 - Flags: review?(oremj) → review+
Comment on attachment 316547 [details] [diff] [review]
fix problem

>--- userslib.php	2008-04-16 12:45:39.000000000 -0700
>+++ userslib2.php	2008-04-18 23:21:55.000000000 -0700
>@@ -1699,13 +1699,14 @@
> 	$values = array();
> 	$sort_mode = $this->convert_sortmode($sort_mode);
> 	$mid = '';
>+    $bonus = '';

Spaces vs. tabs.
r12400.  Hopefully that variable isn't the straw that breaks this bloated camel's back.
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
OS: Mac OS X → All
Hardware: PC → All
Thanks guys -- will figure out why this wasn't caught earlier.
Whiteboard: tiki_triage
Whiteboard: tiki_triage → sumo_triage
Whiteboard: sumo_triage → tiki_bug
Seems to be sumo-only from the discussion.
Whiteboard: tiki_bug → tiki_bug, sumo_triage
morgamic: anything here that should be upstreamed?
Whiteboard: tiki_bug, sumo_triage → sumo_triage, tiki_discuss
Whiteboard: sumo_triage, tiki_discuss → sumo_only
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: