|
[F] Moderators cache - array_merge() reindex bug
|
|
09-15-2008, 09:54 AM
(This post was last modified: 09-18-2008 01:16 PM by Ryan Gordon.)
Post: #1
|
|||
|
|||
|
[F] Moderators cache - array_merge() reindex bug
MyBB 1.4.1, PHP 5.2.4
I have found that logged regular user is made a moderator while accessing forums main page (he can see reported posts). In inc/functions.php I have added a debug message to is_moderator() function: PHP Code: $modcache = $cache->read('moderators');Code: ArrayThe problem is that this users UID is 2 (not 30) and his username - koziolek (not "Amandi"). It seems that problem lies in array_merge which reindex the keys. Look at file inc/class_datacache.php in function build_moderators(): PHP Code: // Append - local settings override that of a parent - array_merge works hereDebug print_r() shows: Code: $forum_mods - before array_merge():www.kozik.net.pl - So... Maybe you shouldn't have hacked it. - And why don't you try not breathing. Hurts, dunnit. (userfriendly.org) |
|||
|
09-15-2008, 11:45 PM
Post: #2
|
|||
|
|||
|
RE: Moderators cache - array_merge() reindex bug
Reproduction instructions? I can't seem to reproduce.
|
|||
|
09-16-2008, 07:25 AM
Post: #3
|
|||
|
|||
|
RE: Moderators cache - array_merge() reindex bug
It was just an upgrade from 1.2 to 1.4.1. I tested it on two different regular users (which existed before upgrade) and both has the same problem.
You can add debug instructions to build_moderators() and rebuild moderators cache. www.kozik.net.pl - So... Maybe you shouldn't have hacked it. - And why don't you try not breathing. Hurts, dunnit. (userfriendly.org) |
|||
|
09-16-2008, 04:22 PM
Post: #4
|
|||
|
|||
|
RE: Moderators cache - array_merge() reindex bug
I can't reproduce - that's why I asked.
|
|||
|
09-17-2008, 01:34 PM
Post: #5
|
|||
|
|||
|
RE: Moderators cache - array_merge() reindex bug
array_merge() (tested in PHP 5.2.4 and PHP 5.2.6-pl6-gentoo) reindex numeric keys in resulting array. Simple test for command line:
PHP Code: <?phpCode: ArrayI do not know how to give a reproduction instructions if the code above does not work ... Anyway a fix is:PHP Code: $forum_mods = $forum_mods + $this->moderators[$forum['fid']]; .
www.kozik.net.pl - So... Maybe you shouldn't have hacked it. - And why don't you try not breathing. Hurts, dunnit. (userfriendly.org) |
|||
|
09-18-2008, 01:18 PM
Post: #6
|
|||
|
|||
|
RE: [F] Moderators cache - array_merge() reindex bug
Thank you for your bug report.
This bug has been fixed in our internal code repository. Please note that the problem will not be fixed here until these forums are updated. With regards, MyBB Group |
|||
|
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)
Search
Member List
Calendar
Help



... Anyway a fix is:
.