WordPress.org

Support

Support » Plugins and Hacks » Wordfence Security » [Bug – fixes included] Plugin causes Undefined index notices in error log

[Bug – fixes included] Plugin causes Undefined index notices in error log

  • 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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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;

    And another one:

    File: /lib/wfScan.php

    Find line 15:

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

    Replace with:

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Bug – fixes included] Plugin causes Undefined index notices in error log’ is closed to new replies.
Skip to toolbar