Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed multiple bugs related to undefined variables #49

Open
jpbellona opened this issue Jun 27, 2012 · 0 comments
Open

Fixed multiple bugs related to undefined variables #49

jpbellona opened this issue Jun 27, 2012 · 0 comments

Comments

@jpbellona
Copy link

Using wp-recaptcha 3.1.6 with WP version 3.4 (all bugs existed also in 3.3.2)

All bugs related to undefined variables.

  1. WP-recaptcha throws errors of undefined variables on all page loads.
    PHP Notice: Undefined variable: rcommentid in /wp-content/plugins/wp-recaptcha/recaptcha.php on line 482
    PHP Notice: Undefined variable: rchash in /wp-content/plugins/wp-recaptcha/recaptcha.php on line 484
    FIX: Added in a check
    if (!empty($_REQUEST['rcommentid']))
    $comment_id = $_REQUEST['rcommentid'];
    if (!empty($_REQUEST['rchash']))
       $comment_hash = $_REQUEST['rchash'];
  1. on a single post with comment form
    PHP Notice: Undefined index: rerror in /wp-content/plugins/wp-recaptcha/recaptcha.php on line 401
    FIX: Added in a check
    if (isset($_GET['rerror'])) {
    $escaped_error = htmlentities($_GET['rerror'], ENT_QUOTES);
    }

  2. on the WP login page (using wp-recaptcha)
    PHP Notice: Undefined index: rerror in /var/www/html/student/bellona/public_html/chinavine2/wp-content/plugins/wp-recaptcha/recaptcha.php on line 278
    FIX: Added in a check
    if (isset($_GET['rerror'])) {
    $escaped_error = htmlentities($_GET['rerror'], ENT_QUOTES);
    } else {
    $escaped_error = '';
    }

  3. after logging a comment
    PHP Notice: Undefined variable: needed_capability in /var/www/html/student/bellona/public_html/chinavine2/wp-content/plugins/wp-recaptcha/recaptcha.php on line 439
    FIX: Nested the conditional for returning the comment since it requires a defined variable

        if ($this->options['bypass_for_registered_users'] && $this->options['minimum_bypass_level']) {
            $needed_capability = $this->options['minimum_bypass_level'];
    
            if (($needed_capability && current_user_can($needed_capability)) || !$this->options['show_in_comments'])
                return $comment_data;
        }
    

That's it. Thanks for your work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant