Support » Plugin: WP Activity Log » WP-CLI (PHP 7) reports empty needle in wp-security-audit-log.php strpos() call

  • Resolved rklrkl


    Using WP-CLI 2.4.0, PHP 7.3.15, WordPress 5.3.2 and WP Security Audit Log 4.0.1, most WP-CLI commands produce a warning and traceback about an “empty needle” in a strpos() call.

    Example (run from the top level of the WordPress web tree):

    wp plugin list
    PHP Warning: strpos(): Empty needle in <webtree>/wp-content/plugins/wp-security-audit-log/wp-security-audit-log.php on line 216

    This would suggest that $rest_url_path is set to a blank string at line 214, so it probably needs to be checked for being blank or not before being used on line 216.

Viewing 1 replies (of 1 total)
  • Plugin Contributor robertabela


    Hello @rklrkl

    Thank you for reporting the issue. We have a similar local setup for testing and we do not get any error (PHP 7.3, WPCLI 2.4.0 WP 5.3).

    This is caused by a string being empty that we ask for when using the WP function home_url(). This function should never be empty, howevever, in your setup it is.

    To cater for this we will add a check in the upcoming version so the plugin can handle such setup.

    I hope the above helps. Should you require further information please do not hesitate to ask.

Viewing 1 replies (of 1 total)
  • The topic ‘WP-CLI (PHP 7) reports empty needle in wp-security-audit-log.php strpos() call’ is closed to new replies.