• Resolved computershowtopro

    (@computershowtopro)


    Because of the fact that the search term not being set, could return different responses from different PHP versions, including one that generates an error in the server’s error log, you need to consider that using _get_search_terms($referer) in line 340 is not recommended.
    Instead, change these two lines (340,341) as follows:
    340) if(self::_get_search_terms($referer) !==””) { $mysearchterm =self::_get_search_terms($referer); } else { $mysearchterm = “unknown”; }
    341) self::$stat[‘searchterms’] = $mysearchterm;

    Otherwise, it can generate needless and useless error messages.

    Thank you for an otherwise great plugin

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Jason Crouse

    (@coolmann)

    Good catch, I will send your note to the developer for his review.

    Jason

    Sa?a

    (@stodorovic)

    I confirm same issue.

    Line 340:
    self::$stat['searchterms'] = self::_get_search_terms($referer);

    But lines 351-353:

    if ( !empty( $referer ) ) {
             self::$stat[ 'searchterms' ] = self::_get_search_terms( $referer );
    }

    So, first block should be same as the second.

    debug.log:
    PHP Notice: Undefined variable: referer in …/wp-content/plugins/wp-slimstat/wp-slimstat.php on line 340
    If you need, I can check access.log and find way how to reproduce this issue.

    • This reply was modified 8 years, 3 months ago by Sa?a.
    Sa?a

    (@stodorovic)

    I’ve noticed an other PHP notice. It’s related to following code:

    if ( !empty( $match[ 1 ] ) && stristr( $match[ 1 ], 'Version' ) === false ) {
            $webkit_info = explode( '/', $match[ 1 ] );
            $browser[ 'browser' ] = $webkit_info[ 0 ];
            $browser[ 'browser_version' ] = floatval( $webkit_info[ 1 ] );
    }

    PHP Notice: Undefined offset: 1 in …/wp-content/plugins/wp-slimstat/browscap/uadetector.php on line 124

    It’s possible that $webkit_info contains only one element in array. It’s case for useragent Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/534.34 (KHTML, like Gecko) wkhtmltoimage Safari/534.34 and line:
    browser[ 'browser_version' ] = floatval( $webkit_info[ 1 ] );
    should be
    $browser[ 'browser_version' ] = !empty( $webkit_info[ 1 ] ) ? floatval( $webkit_info[ 1 ] ) : 0;

    I hope that’s helpful. Please forward this message to developers together with previous.

    I like this plugin and it’s my favourite plugin for statistics.

    Plugin Author Jason Crouse

    (@coolmann)

    Thank you, guys. Both issues are being fixed in version 4.5, which should be released before the end of the year ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘You need to change line 340..341 in the plugin’ is closed to new replies.