-
-
Notifications
You must be signed in to change notification settings - Fork 840
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Undefined array key 3 in ./inc/media.php on line 1700 #4276
Comments
This is not entirely true actually, something fishy is going on here... Given the following namespaces hierarchy
Accessing the URL http://example.com/dokuwiki/doku.php?do=media&ns=XXX
|
Not very likely ;-) But let's assume you meant 2024-02-06a Kaos. I can not reproduce this using: DW: 2024-02-06a Kaos So whatever is going on, must be still more obscure. |
Indeed. Sorry about that, fixed.
Do you have any namespaces after |
I think I've nailed it. I'll submit a pull request shortly. |
No. I don't have any sub-namespaces in the Note: I am seeing some unrelated warnings from the Discussion plugin which I have installed (not actively used except for a few test pages). I don't think these warnings have any bearing on your issue though. |
I don't know what to say. This is consistently reproducible for me, with a fresh install of DokuWiki from Git master, with every plugin disabled. |
OK let me rephrase that. With master branch, I get the PHP warnings, but the temporary namespace is added. I was actually testing with a commit fixing the PHP warning that started this whole thing (adding an array_key_exists() check to the while loop in media_nstree()). In this case, no more warnings but the temp namespace is gone. |
E_WARNING: Undefined array key 3 in ./inc/media.php(1700) E_WARNING: Trying to access array offset on value of type null in ./inc/media.php(1700) This happens when the media manager is called with ns parameter set to a value higher than the last namespace defined in the wiki. Fixes dokuwiki#4276
When the media manager is called with ns parameter set to a value higher than the last namespace defined in the wiki, the non-existing namespace is not added to the hierarchy. This behavior is not consistent with what happens when the namespace's name is lower. In this case, an entry is inserted in the tree at the appropriate location. Fixed by appending the temporary namespace at the end of the tree if it was not inserted by the search loop. Fixes dokuwiki#4276
The problem
My wiki's error log is swamped with hundreds of occurrences of the following errors, every day.
E_WARNING: Undefined array key 3 in ./inc/media.php(1700)
E_WARNING: Trying to access array offset on value of type null in ./inc/media.php(1700)
I was initially not able to reproduce the problem, so I searched the web server's logs for more information and found out that most of these requests seem to be triggered by bots; analyzing the queries, I realized that the problem occurs when an unknown or unaccessible namespace is referenced when opening the media manager with the following URL
http://example.com/dokuwiki/doku.php?do=media&ns=XXX
Where XXX is the offending namespace (e.g. from my logs:
wiki:backup
, which does not exist)Version of DokuWiki
2024-02-06a Kaos (reproducible in master @ 31afae8)
PHP Version
8.2.16
Webserver and version of webserver
No response
Browser and version of browser, operating system running browser
No response
Additional environment information
No response
Relevant logs and/or error messages
No response
The text was updated successfully, but these errors were encountered: