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

Declares multisite init_site methods as static #210

Merged
merged 1 commit into from
Jun 21, 2021
Merged

Declares multisite init_site methods as static #210

merged 1 commit into from
Jun 21, 2021

Conversation

walterebert
Copy link
Contributor

In a multisite setup on PHP 8 initialisation methods cause a fatal error when adding/deleting a site. Declaring these methods as static fixes the problem.

Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($function) must be a valid callback, non-static method Statify_Install::init_site() cannot be called statically

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@stklcode stklcode added the bug label Jun 21, 2021
@stklcode stklcode added this to the 1.8.3 milestone Jun 21, 2021
@stklcode
Copy link
Contributor

Thanks @walterebert for this fix.

The non-static declaration was probably never correct and did raise a warning with the latest PHP 7.x versions. Solutions looks reasonable.

Automated tests are not running for another reason, I will have a closer look at it later today.

@walterebert
Copy link
Contributor Author

Unit tests for WordPress don't work with PHP 8 as far as I know. PHPUnit Polyfills might help, but I haven't used it yet: https://github.com/Yoast/PHPUnit-Polyfills

@stklcode
Copy link
Contributor

I'm aware of the restrictions due to the PHPUnit 7 limit and our test cases do run fine with PHP 8 as long as you install with --ignore-platform-req=php. Current reason is the travis-ci.org to travis-ci.com migration that has not been done yet for this project, because we actually wanted to move to GH actions - the corresponding PR has not been merged either, so there's no CI at the moment.

Copy link
Contributor

@stklcode stklcode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@stklcode stklcode merged commit d37b2be into pluginkollektiv:develop Jun 21, 2021
@walterebert walterebert deleted the fix-multisite-install branch June 21, 2021 17:25
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 this pull request may close these issues.

2 participants