PHP 7 warnings filling up error log after upgrade to 2.4.8.4

Since upgrading from 2.4.6 to 2.4.8.4 on a server running PHP 7.3 we’ve been having spikes every night in our PHP error logs with warnings like the ones shown below. Last night the log grew to 1614871708 bytes in a few hours.Our php.ini file currently has:
error_reporting = (E_ALL ^ (E_NOTICE | E_WARNING));
I’m told we’ve tried this also:
error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING
but neither seemed to work to reduce the logging. Does anyone have a solution?

Thanks,

Jeffery

[Wed Jul 17 22:17:29.132973 2019] [php7:notice] [pid 11353] [client 46.229.168.163:12650] ojs2 has produ
ced an error\n Message: WARNING: Declaration of GenericPlugin::manage($verb, $args, &$message, &$messag
eParams) should be compatible with PKPPlugin::manage($verb, $args, &$message, &$messageParams, $request
= NULL)\n In file: /u1/htdocs/njs/lib/pkp/classes/plugins/GenericPlugin.inc.php\n At line: 19\n Stack
trace: \n Server info:\n OS: Linux\n PHP Version: 7.3.6\n Apache Version: Apache/2.4.6 (CentOS) O
penSSL/1.0.2k-fips PHP/7.3.6\n DB Driver: mysql\n DB server version: 5.5.60-MariaDB
[Wed Jul 17 22:17:29.133076 2019] [php7:notice] [pid 11353] [client 46.229.168.163:12650] ojs2 has produ
ced an error\n Message: WARNING: Declaration of UsageStatsPlugin::getManagementVerbs() should be compat
ible with GenericPlugin::getManagementVerbs($verbs = Array)\n In file: /u1/htdocs/njs/plugins/generic/u
sageStats/UsageStatsPlugin.inc.php\n At line: 19\n Stacktrace: \n Server info:\n OS: Linux\n PHP
Version: 7.3.6\n Apache Version: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.3.6\n DB Driver: my
sql\n DB server version: 5.5.60-MariaDB
[Wed Jul 17 22:17:29.138890 2019] [php7:notice] [pid 11353] [client 46.229.168.163:12650] ojs2 has produ
ced an error\n Message: WARNING: Declaration of ReportPlugin::manage($verb, $args) should be compatible
with PKPPlugin::manage($verb, $args, &$message, &$messageParams, $request = NULL)\n In file: /u1/htdoc
s/njs/classes/plugins/ReportPlugin.inc.php\n At line: 252\n Stacktrace: \n Server info:\n OS: Linux
\n PHP Version: 7.3.6\n Apache Version: Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.3.6\n DB D
river: mysql\n DB server version: 5.5.60-MariaDB

Hi @Jeffery_Triggs,

Potentially a silly question, but are you sure you restarted the web server after changing php.ini? It’s odd that warnings are being logged despite that being specified as disabled.

Regards,
Alec Smecher
Public Knowledge Project Team

I was told by the sysadmin that we did, but I may want to double check that. I too find it odd that changed to php.ini don’t seem to take. Is it at all possible that this file might be overriding the ini directives?
/u1/htdocs/njs/lib/pkp/classes/core/PKPApplication.inc.php

Jeffery

I think I have solved the log problem after testing out this :
lib/pkp/classes/core/PKPApplication.inc.php

The changes I made are listed below:

class PKPApplication {
        var $enabledProducts;
        var $allProducts;

        function PKPApplication() {
                // Configure error reporting
                // FIXME: Error logging needs to be suppressed for strict
                // and deprecation errors in PHP5 as long as we support PHP 4.
                // This is primarily for static method warnings and warnings
                // about use of ... =& new ... Static class members cannot be
                // declared in PHP4 and ... =& new ... is deprecated since PHP 5.
                $errorReportingLevel = E_ALL;
                if (defined('E_STRICT')) $errorReportingLevel &= ~E_STRICT;
                if (defined('E_DEPRECATED')) $errorReportingLevel &= ~E_DEPRECATED;
                // Added by JAT 072219
                if (defined('E_WARNING')) $errorReportingLevel &= ~E_WARNING;
                if (defined('E_NOTICE')) $errorReportingLevel &= ~E_NOTICE;
                // /Added by JAT 072219
                @error_reporting($errorReportingLevel);
1 Like

Thank you Jeffery,

your changes to PKPApplication.inc.php stopped spamming of error_log with ojs2 warnings :smile:
And I didn’t have to edit the php.ini, the ojs2 warnings are no longer written to the error_log. It’s weirdly quiet now :face_with_raised_eyebrow:. Did some quick tests, if I break some code, the PHP errors get recorded, so I guess it’s fine.

Cheers, Ales

i think PHP was not really good moving from 5 to 7 !!
In 7, what was a notice or a deprecated is now a warning : the same level of a mysql error … that’s inacceptable and I tel you why.

If you want to log errors and catch important mysql error or others errors, you have to keep E_WARN, but your log will fill up with every non defined constant or variable notice (sholud be a notice).

I do have dozen of old projects an I surely dont want to define every variable which I wrote more than 10y ago.

So two option: let php7 degrade my really expensive SSDs writing Gbytes / hours or implement a complex server level monitoring ( with auto_[pre-ap]pend_file in php.ini)

Custom overriding the level of php errors should be easy to implement in the core and super handy and flexible …