• Resolved Anonymous User 119842

    (@anonymized-119842)


    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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Anonymous User 119842

    (@anonymized-119842)

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

    Plugin Author Mostafa Soufi

    (@mostafas1990)

    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

    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 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘PHP notice in debug mode if HTTP_REFERER is not set’ is closed to new replies.