Skip to content
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

Warning: Trying to access array offset on value of type bool in /....../inc/Ui/Recent.php on line 165 #4235

Open
JoBongHyeon opened this issue Mar 6, 2024 · 3 comments · May be fixed by #4236
Labels

Comments

@JoBongHyeon
Copy link

JoBongHyeon commented Mar 6, 2024

The problem

There is an error message.

Warning: Trying to access array offset on value of type bool in /....../inc/Ui/Recent.php on line 165

There is an error message.

I use 'Manage Access Control List'.

when I log in and open the Recent Changes page, I don't see an error message.

An error message appears when i open the Recent Changes page as a guest.

Version of DokuWiki

koas

PHP Version

8.3

@JoBongHyeon JoBongHyeon added the Bug label Mar 6, 2024
@fiwswe
Copy link
Collaborator

fiwswe commented Mar 7, 2024

Not sure about the root cause, but

public function getCurrentRevisionInfo()
is documented to return a bool or an array. In your case it must have returned a bool but unfortunately that case is not handled in:
protected function checkCurrentRevision(array &$info)

So yes, there is a bug here.

Does it help to change

if ($currentRevInfo['type'] == DOKU_CHANGE_TYPE_DELETE) {
to

            if (($currentRevInfo['type'] ?? null) == DOKU_CHANGE_TYPE_DELETE) {

in line 165?

@JoBongHyeon
Copy link
Author

Yes, thank you. I fixed it as you said and solved the problem.

@fiwswe
Copy link
Collaborator

fiwswe commented Mar 7, 2024

This should be closed when the issue is fixed in DokuWiki.master.

@fiwswe fiwswe reopened this Mar 7, 2024
fiwswe added a commit to fiwswe/dokuwiki that referenced this issue Mar 7, 2024
Fix dokuwiki#4235

Note: This class of problem, i.e. mismatch between documented return values vs. use of them in consumers, is somewhat prevalent and very hard to find unless they happen to trigger a warning or error.

Fixing them as they come up is ok I guess but some sort of automated method to detect these would be great.
This was referenced Mar 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants