Skip to content

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

Description

@florencebejo

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...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions