• Resolved squarestar

    (@squarestar)


    This file: advanced-nocaptcha-recaptcha/anr-captcha-class.php has a bug in the registration_verify() method. On line 453 it tries to return the $result variable, but it does not exist.

    In any case the method needs to always return an instance of WP_Error because other plugins need to be able to run that object’s methods. For example, a PHP error is thrown if another plugin that hooks later tries to run $errors->has_errors().

    The whole method should probably be:

    
    function registration_verify( $errors, $sanitized_user_login, $user_email ) {
     if ( ! $this->verify() ) {
      $errors->add( 'c4wp_error', $this->add_error_to_mgs() );
     }
    
     return $errors;
    }
    
    • This topic was modified 3 years ago by squarestar. Reason: typo
    • This topic was modified 3 years ago by squarestar. Reason: Added example of why PHP error thrown
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author robertabela

    (@robert681)

    Thank you for your message and for using our plugin @squarestar

    I have escalated this to the developers. I will get back to you with an update as soon as we have one.

    Thank you for your patience.

    Plugin Support Danny Jones

    (@distinctivepixels)

    Hello @squarestar,

    Thanks for reporting this – iv prepared a patch here https://wpwhitesecurity.com/downloads/support/advanced-nocaptcha-recaptcha-preview.zip for you which address’s this and of course we shall include this in the next update etc also.

    If there is anything else in future, or if you continue to experience an issue, do be sure to let us know.

    Kind regards, Daniel @ WP White Security

    Plugin Author robertabela

    (@robert681)

    Hello @squarestar

    Can you please confirm if the patch addresses the issue for you?

    Looking forward to hearing from you.

    Thread Starter squarestar

    (@squarestar)

    Thanks @robert681 – that seems to address that problem, however I notice the same issue in one of the other class methods. The reset_password_verify() takes $errors as the first argument, but passes $user back out under one condition, and nothing under another condition.

    With filters, you always have to return the first argument no matter what you do or don’t do with it in your own code. Otherwise other plugins that hook into the same filter afterwards will get nothing (or the wrong thing) and may not function.

    Plugin Author robertabela

    (@robert681)

    That’s a valid point @squarestar

    I’ve already reported this so it can be addressed in the next plugin update. Thank you for reporting this. Should there be anything else we can help you with, please let us know.

    Have a great day.

    Plugin Author robertabela

    (@robert681)

    Hello @squarestar

    We have just released update 7.1.0 which includes this update as well. Please update the plugin to the latest version.

    Thank you for using our plugin. Should there be anything else we can assist you with, please do not hesitate to ask.

    Have a great day.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Bug causes PHP error’ is closed to new replies.