turnermm / news

Dokuwiki plugin for creating external newsfeeds for feed readers
http://www.dokuwiki.org/plugin:news
0 stars 6 forks source link

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

Open florencebejo opened 1 year ago

florencebejo commented 1 year ago

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.

https://github.com/turnermm/news/blob/556847f949768b96135e679bf8654b23bf96ef16/action.php#L36

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 https://github.com/turnermm/news/blob/556847f949768b96135e679bf8654b23bf96ef16/action.php#L24 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 commented 8 months ago

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