Thank you @dbais for reporting this.
The minimum version of PHP that the plugin can run on is 5.4.43. Can you please confirm if you run a more recent or older version?
Also, I am presuming you are seeing this error in your error logs. However does the plugin still work or you’re encountering usage problems as well apart from the error?
Thread Starter
dbais
(@dbais)
Site is running PHP v5.4.45
Front end is working OK. But the back end was generating a 500 server error for all the URLs I tried. So I removed the wp-security-audit-log plugin folder and the back end is now working normally.
HEllo @dbais
The plugin should work on that version of PHP. However it is hard to tell exactly what is wrong because every setup is unique.
Can you please contact us via email ([email protected]) and send us the system information file? We might find some information in it that will help us reproduce and solve this issue.
Looking forward to hearing from you.
Thread Starter
dbais
(@dbais)
Info on its way.
Meanwhile in attempt to try to replicate the issue I ran a test on a development site which I updated to the latest versions of WordPress and all installed plugins.
WP Security Audit Log wasn’t activated on the dev site. After the updates were completed I attempted to activate the WP Security Audit Log plugin and had this error message displayed in WordPress:
Fatal error: Can’t use function return value in write context in <server path>/wp-content/plugins/wp-security-audit-log/classes/Views/AuditLog.php on line 459
Call Stack
# Time Memory Function Location
1 0.0019 412616 {main}( ) …/plugins.php:0
2 1.3972 84728896 plugin_sandbox_scrape( ) …/plugins.php:175
3 1.3994 85070568 include( ‘<server path>/wp-content/plugins/wp-security-audit-log/wp-security-audit-log.php’ ) …/plugin.php:2050
4 1.4661 90983200 WpSecurityAuditLog::GetInstance( ) …/wp-security-audit-log.php:1641
5 1.4661 90983416 WpSecurityAuditLog->__construct( ) …/wp-security-audit-log.php:158
6 1.4663 90986816 WpSecurityAuditLog->includes( ) …/wp-security-audit-log.php:169
So that’s the same error I reported before – this time with a stack trace.
The dev environment runs the same version of PHP as the live site.
When I switched the dev site to use PHP 5.6.40 the plugin activated normally
That does seem to point towards something in the code at the location indicated which is incompatible with the older version of PHP that was introduced in a recent update of the plugin.
Thread Starter
dbais
(@dbais)
As I thought, it is an issue with line 459 of AuditLog.php where this bit of the if statement is triggering the error:
empty( trim( $this->page_args->search_term ) )
If I evaluate that and assign it to a variable and use that in the if statement instead, then it all works fine.
Same issue.
Just updated the plug-in and now my Dashboard is broken.
PHP ver 7.1
I have deleted the plug-in via FTP and am now able to use WP again. Hopefully you can patch and offer an updated version soon.
Hello @dbais and @gomisan
We have a fix for you. Can you please:
1. download this patch?
2. Copy the extracted file to /wp-content/wp-security-audit-log/classes/Views/, replacing the old AuditLog.php file.
Can you please confirm back that this fixes the issue?
Looking forward to hearing from you.
Thread Starter
dbais
(@dbais)
That has fixed the problem. Thanks.
If you wanted to retain the trim() you could use:
$trimmed = trim( $this->page_args->search_term );
$is_search_view = class_exists( ‘WSAL_SearchExtension’ ) && ( ! empty( $this->page_args->search_filters ) || ! empty( $trimmed ) );
Glad it is sorted @dbais and all has been handled.
Would appreciate if you can spare a minute to rate our plugin and service.
Have a good day.