lechab/newstatpress

Newstatpress not working with PHP 7.1

Closed this issue · 3 comments

Hi!

Just wanted to start off by saying thank you for making this plugin - Statpress (and now newstatpress) has been my go-to for WordPress stats for years.

I'm having a bit if a problem with Newstatpress crashing sites (resulting in the dreaded error 500) when using PHP 7.1 (specifically 7.1.7 on Windows Server 2016). When WordPress debugging mode is enabled, the following error comes up:

Fatal error: Uncaught ArgumentCountError: Too few arguments to function nsp_BuildPluginSQLTable(), 0 passed in removed for privacywp-content\plugins\newstatpress\newstatpress.php on line 1133 and exactly 1 expected in removed for privacy\wp-content\plugins\newstatpress\newstatpress.php:871 Stack trace: #0 removed for privacy\wp-content\plugins\newstatpress\newstatpress.php(1133): nsp_BuildPluginSQLTable() #1 removed for privacy\wp-includes\class-wp-hook.php(298): nsp_StatAppend(Object(WP)) #2 removed for privacy\wp-includes\class-wp-hook.php(323): WP_Hook->apply_filters('', Array) #3 removed for privacy\wp-includes\plugin.php(515): WP_Hook->do_action(Array) #4 removed for privacy\wp-includes\class-wp.php(518): do_action_ref_array('send_headers', Array) #5 removed for privacy\wp-includes\class-wp.php(734): WP->send_headers() #6 removed for privacy\wp-content\plugins\newstatpress\newstatpress.php on line 871

It works alright with PHP 7.0 (comes up with an error if WordPress debugging mode is enabled, but when that's disabled pages load fine) so I've changed back to PHP 7.0, but I'd rather use the latest if at all possible.

Have had this error with 5 websites (after upgrading PHP on the server).

Any ideas?

ice00 commented

hi,

please try to current git version as I did not have php 7.1 in my server for testing.
The problem seems a more rigid PHP 7.1 control on missing parameter.

Thanks

Works perfectly now, thank you!

ice00 commented

Good.

I will test a little on my servers than I release this version for all.

thanks