Title: Bug causes PHP error
Last modified: March 23, 2022

---

# Bug causes PHP error

 *  Resolved [squarestar](https://wordpress.org/support/users/squarestar/)
 * (@squarestar)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/bug-causes-php-error/)
 * 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 4 years, 2 months ago by [squarestar](https://wordpress.org/support/users/squarestar/).
      Reason: typo
    -  This topic was modified 4 years, 2 months ago by [squarestar](https://wordpress.org/support/users/squarestar/).
      Reason: Added example of why PHP error thrown

Viewing 6 replies - 1 through 6 (of 6 total)

 *  Plugin Support [robertabela](https://wordpress.org/support/users/robert681/)
 * (@robert681)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/bug-causes-php-error/#post-15494435)
 * Thank you for your message and for using our plugin [@squarestar](https://wordpress.org/support/users/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.
 *  [Danny Jones](https://wordpress.org/support/users/distinctivepixels/)
 * (@distinctivepixels)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/bug-causes-php-error/#post-15501753)
 * Hello [@squarestar](https://wordpress.org/support/users/squarestar/),
 * Thanks for reporting this – iv prepared a patch here [https://wpwhitesecurity.com/downloads/support/advanced-nocaptcha-recaptcha-preview.zip](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 Support [robertabela](https://wordpress.org/support/users/robert681/)
 * (@robert681)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/bug-causes-php-error/#post-15508672)
 * Hello [@squarestar](https://wordpress.org/support/users/squarestar/)
 * Can you please confirm if the patch addresses the issue for you?
 * Looking forward to hearing from you.
 *  Thread Starter [squarestar](https://wordpress.org/support/users/squarestar/)
 * (@squarestar)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/bug-causes-php-error/#post-15510376)
 * Thanks [@robert681](https://wordpress.org/support/users/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 Support [robertabela](https://wordpress.org/support/users/robert681/)
 * (@robert681)
 * [4 years, 2 months ago](https://wordpress.org/support/topic/bug-causes-php-error/#post-15513155)
 * That’s a valid point [@squarestar](https://wordpress.org/support/users/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 Support [robertabela](https://wordpress.org/support/users/robert681/)
 * (@robert681)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/bug-causes-php-error/#post-15785549)
 * Hello [@squarestar](https://wordpress.org/support/users/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.

 * ![](https://ps.w.org/advanced-nocaptcha-recaptcha/assets/icon-256x256.png?rev
   =2961544)
 * [CAPTCHA 4WP - Antispam CAPTCHA solution for WordPress](https://wordpress.org/plugins/advanced-nocaptcha-recaptcha/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-nocaptcha-recaptcha/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-nocaptcha-recaptcha/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-nocaptcha-recaptcha/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-nocaptcha-recaptcha/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-nocaptcha-recaptcha/reviews/)

## Tags

 * [php-error](https://wordpress.org/support/topic-tag/php-error/)

 * 6 replies
 * 3 participants
 * Last reply from: [robertabela](https://wordpress.org/support/users/robert681/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/bug-causes-php-error/#post-15785549)
 * Status: resolved