WordPress.org

Forums

Wordfence Security
[Bug - fixes included] Plugin causes Undefined index notices in error log (3 posts)

  1. jrf
    Member
    Posted 2 years ago #

    L.S.,

    Thanks for this excellent plugin! Very happy to have found it.

    When going through my error logs however I noticed numerous undefined index notices caused by this plugin. I've fixed the ones I found and I hope you will accept the below fixes as a compliment to your work.

    Line numbers are based on the latest plugin version, v3.7.2.

    File: lib/menu_rangeBlocking.php

    Find line 18:

    <tr><th>Block anyone that has an IP address in this range:</th><td><input id="ipRange" type="text" size="30" maxlength="255" value="<?php if($_GET['wfBlockRange']){ echo $_GET['wfBlockRange']; } ?>" onkeyup="WFAD.calcRangeTotal();">&nbsp;<span id="wfShowRangeTotal"></span></td></tr>

    Replace with:

    <tr><th>Block anyone that has an IP address in this range:</th><td><input id="ipRange" type="text" size="30" maxlength="255" value="<?php if( isset( $_GET['wfBlockRange'] ) && $_GET['wfBlockRange']){ echo $_GET['wfBlockRange']; } ?>" onkeyup="WFAD.calcRangeTotal();">&nbsp;<span id="wfShowRangeTotal"></span></td></tr>

    File: lib/menu_whois.php

    Find line 27:

    <?php if($_GET['wfnetworkblock']){ ?>

    Replace with:

    <?php if( isset( $_GET['wfnetworkblock'] ) && $_GET['wfnetworkblock']){ ?>

    Find line 53:

    var whoisval = "<?php echo $_GET['whoisval']; ?>";

    Replace with:

    var whoisval = "<?php if( isset( $_GET['whoisval'] ) ) { echo $_GET['whoisval']; } ?>";

    File: lib/schedWeekEntry.php

    Find line 23:

    $checked = ($sched[$dayIndex][$hour] ? 'checked' : '');

    Replace with:

    $checked = ( isset( $sched[$dayIndex] ) && $sched[$dayIndex][$hour] ? 'checked' : '');

    File: lib/wfLog.php

    Find line 400:

    if($res['referer']){

    Replace with:

    if( isset( $res['referer'] ) && $res['referer']){

    Find line 417-420:

    parse_str($refURL['query'], $queryVars);
    							if(isset($queryVars[$q])){
    								$res['searchTerms'] = $queryVars[$q];
    							}

    Replace with:

    if( isset( $refURL['query'] ) ) {
    								parse_str($refURL['query'], $queryVars);
    								if(isset($queryVars[$q])){
    									$res['searchTerms'] = $queryVars[$q];
    								}
    							}

    Find line 425:

    if ( stristr( $referringPage['host'], 'google.' ) )

    Replace with:

    if ( isset( $referringPage ) && stristr( $referringPage['host'], 'google.' ) )

    File: lib/wordfenceClass.php

    Find line 894:

    if($err){

    Replace with:

    if(isset( $err ) && $err){

    Find line 1356:

    if($result['errorMsg']){

    Replace with:

    if( isset( $result['errorMsg'] ) && $result['errorMsg']){

    Hope this helps!

    Smile,
    Juliette

    http://wordpress.org/extend/plugins/wordfence/

  2. jrf
    Member
    Posted 2 years ago #

    And another fix - this one fixing the 'never ending save', i.e. clicking save will start the save action, but to the user, it never seems to end as no feedback is returned and the spinner keeps spinning.

    File: lib/wordfenceClass.php

    Find line 340:

    die(json_encode($returnArr));

    Replace with:

    die(json_encode($returnArr));
    exit;
  3. jrf
    Member
    Posted 2 years ago #

    And another one:

    File: /lib/wfScan.php

    Find line 15:

    if( $_GET['test'] == '1'){

    Replace with:

    if( isset( $_GET['test'] ) && $_GET['test'] == '1'){

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Wordfence Security
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags