dokuwiki icon indicating copy to clipboard operation
dokuwiki copied to clipboard

ERROR removing multiple users

Open knulo opened this issue 4 months ago • 15 comments

The problem

While removing multiple users at once an error occurs (illegal offset or similar, line 94 in auth.php). Debugging this and found out, that $user is an array in case of removing more than one user. So, $this->users[$user] couldn't retrieved. The following change fixed the problem: all selected users removed successfully.

public function getUserData($user, $requireGroups = true) { if ($this->users === null) $this->loadUserData(); //+++ knulo 2025-12-02 if (is_array($user)) { $rtrn = []; foreach($user as $u) $rtrn[] = $this->getUserData($u, $requireGroups); return $rtrn; } //--- knulo 2025-12-02 return $this->users[$user] ?? false; }

Version of DokuWiki

Release 2025-05-14b "Librarian"

PHP Version

PHP 8.2.29 Linux 6.1.129 fpm-fcgi

Webserver and version of webserver

No response

Browser and version of browser, operating system running browser

Firefox latest on Win 11 prof.

Additional environment information

No response

Relevant logs and/or error messages


knulo avatar Dec 02 '25 17:12 knulo

Which file did you put your fix in? Was that here: https://github.com/dokuwiki/dokuwiki/blob/36855f452ffcb08f5441c1830c50ed1008b4f2cc/lib/plugins/authplain/auth.php#L94-L98

If so, what about other authentication methods? Could they be affected as well?

Actually the documentation comment above the method states that $user has to be a string not an array. So the root cause may be somewhere else, wherever that method is called from. https://github.com/dokuwiki/dokuwiki/blob/36855f452ffcb08f5441c1830c50ed1008b4f2cc/lib/plugins/authplain/auth.php#L90

In summary either the caller needs to fixed to only pass a string for the $user parameter, or the API of the authentication system must be fixed to deal with string or array for the $user parameter.

fiwswe avatar Dec 02 '25 23:12 fiwswe

@fiwswe You stated the right file, I changed dokuwiki/lib/plugins/authplain/auth.php I don't check other authentication methods and you're right: better to fix it in the routine calling the specific method. But for me, changing the Plain Auth was sufficient. ;-) Thank you for clarification.

knulo avatar Dec 03 '25 07:12 knulo

I can not reproduce this. Please remove your patch and send a stacktrace for when the issue occurs.

splitbrain avatar Dec 03 '25 08:12 splitbrain

@splitbrain The php error log of yesterday (first time I got the error) shows: [02-Dec-2025 17:53:01 Europe/Berlin] PHP Warning: Array to string conversion in /xxx/lib/plugins/authplain/auth.php on line 93 The backend shows a (catched) error message like I explained in my first post. I selected four users to remove and hit than Remove. At the moment I'm in a hurry, maybe I can reproduce this this afternoon and provide more informations.

knulo avatar Dec 03 '25 09:12 knulo

Have reproduced that behavior:

  • Commented out my patch
  • Add two users and filter by group (four users)
  • Mark the two previously added user

Image

  • Click Remove (Ausgewählte löschen)
  • Error in backend (stated line 102 because of the commented out lines, is line 94 in original file)
  • NO message in php error log

Image

  • Restore my patch
  • Refresh browser
  • Correct function

Image

knulo avatar Dec 03 '25 11:12 knulo

Please check the DokuWiki error log. It should have a stack trace. I did what you describe on master and can't reproduce it. Either something is weird in your setup or it has been fixed in master already.

splitbrain avatar Dec 03 '25 12:12 splitbrain

May be ... How to update your plugins marked as <bundled>?

knulo avatar Dec 03 '25 13:12 knulo

Please check the DokuWiki error log. It should have a stack trace.

splitbrain avatar Dec 03 '25 13:12 splitbrain

Sorry, but there are no wiki specific log files: directory /data/log/error/ is empty. $conf['dontlog'] = 'debug';

knulo avatar Dec 03 '25 14:12 knulo

Damn. The thing is, I can not reproduce this in stable either. The place where you "fixed" it is the wrong approach as explained by @fiwswe, so we need to figure out what exactly is causing this issue for you. Eg. what does call this method with an array instead of a string. Might be some action plugin interfering?

splitbrain avatar Dec 04 '25 08:12 splitbrain

D'accord! Unfortunately, at the moment I haven't the time to go deeper in this. But I'll be back, if I found out more. Will create a local instance for further investigations.

knulo avatar Dec 04 '25 10:12 knulo

@knulo Do you have other plugins installed than the bundled plugins? Which?

Klap-in avatar Dec 04 '25 10:12 Klap-in

YES (a bunch of this)! 😎

  • BackupTool for DokuWiki 1.0.1 von Terence J. Grant
  • Cell Background von dr4ke
  • color syntax plugin von Harald Hanche-Olsen
  • config:htmlok Plugin von Luis Machuca Bezzaza
  • Dw2Pdf plugin von Andreas Gohr and Luigi Micco
  • include plugin von Michael Hamann, Gina Häussge, …
  • Indexmenu Plugin von Samuele Tognini, Gerrit Uitslag
  • IssueTracker von Taggic (outdated, could be removed...)
  • Login/Logout logging plugin von Andreas Gohr, Anna Dabrowska
  • logviewer plugin von Andreas Gohr
  • PDF-Tools for dw2pdf von Gero Gothe
  • PopUpViewer von i-net software (outdated, but works)
  • smtp plugin von Andreas Gohr
  • subnumberlist von Szymon Olewniczak
  • SyntaxHighlighter3 Plugin von CrazyMax
  • Table Width Plugin von Mykola Ostrovskyy
  • totop plugin von Knut Lohse (displays 'jump arrows' while scrolling)
  • DokuWiki Upgrade Plugin von Andreas Gohr
  • Wikicalendar Plugin von Michael Klier (outdated, could be removed...)
  • Wrap Plugin von Anika Henke

I'll look for plugins that can be deactivated/removed soon, btw: how can I retrieve unused plugins?

knulo avatar Dec 04 '25 10:12 knulo

Hmm... none of these look like they should interfere here.

splitbrain avatar Dec 04 '25 10:12 splitbrain

Good news for me, bad news for investigation ... 😂

knulo avatar Dec 04 '25 11:12 knulo