WordPress.org

Ready to get started?Download WordPress

Forums

WP Statistics
[resolved] PHP notice in debug mode if HTTP_REFERER is not set (4 posts)

  1. naglis
    Member
    Posted 10 months ago #

    Hi,
    I used WordPress 3.6.1 in debug mode, WP-Statistics 3.2 all running on PHP 5.4.19.

    When I browse, I strip my HTTP headers of the HTTP_REFERER header, and if WordPress is in debug mode, I get the following notice:

    Notice: Undefined index: HTTP_REFERER in wp-content/plugins/wp-statistics/includes/class/statistics.class.php on line 125

    I took a quick look at the code line in question and it seems that it assumes that $_SERVER['HTTP_REFERER'] will be set.

    Regards,
    Naglis

    http://wordpress.org/plugins/wp-statistics/

  2. naglis
    Member
    Posted 10 months ago #

    Moreover, I've noticed that get_Referred() uses wpdb::escape() which is deprecated since WordPress 3.6.

  3. Mostafa Soufi
    Member
    Plugin Author

    Posted 9 months ago #

    hi,
    http://stackoverflow.com/questions/12369615/serverhttp-referer-missing

    Moreover, I've noticed that get_Referred() uses wpdb::escape() which is deprecated since WordPress 3.6.
    You're right.
    But does it work

  4. kitchin
    Member
    Posted 5 months ago #

    For how long?
    It's much easier to just use esc_sql(), pure function, no object. It would easier for me if the plugin ran clean in WP_DEBUG.

    I would also fix the other two, with this at Line 111:

    if( $default_referr ) {
    	if( empty( $_SERVER['HTTP_REFERER'] ) ) {
    		return esc_sql( get_bloginfo('url') );
    	} else {
    		return esc_sql(strip_tags($_SERVER['HTTP_REFERER']));
    	}
    } else {
    	return esc_sql(strip_tags(@$_SERVER['HTTP_REFERER']));
    }

    If return after else is you style ;)

Reply

You must log in to post.

About this Plugin

About this Topic