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

"Error: Call to a member function has_permission() on null" when using php8 #20

Open
florencebejo opened this issue Mar 10, 2023 · 1 comment

Comments

@florencebejo
Copy link

florencebejo commented Mar 10, 2023

The package was working mostly fine for us until we updated our php version to php8. Since then it seems that the helpers do not get loaded properly.

$perm = $this->helper->has_permission();

throws the error "Error: Call to a member function has_permission() on null".

--EDIT:

On the Backward Incompatible Changes page for PHP80, they mention

Methods with the same name as the class are no longer interpreted as constructors. The __construct() method should be used instead.

So I think that replacing

function action_plugin_news() {

by public function __construct(){ should solve it.

I do not program in PHP so I would like someone with a bit more experience in the language to check it before making a merge pull request...

@wolfgangasdf
Copy link

Great, I probably would not have found this - I made a pull request, you can install the updated plugin "manually" from https://github.com/wolfgangasdf/dokuwiki-plugin-news/archive/refs/heads/master.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants