• 
    PHP Notice:  Undefined index: source in /path/to/wp-content/plugins/awin-advertiser-tracking/awin-advertiser-tracking.php on line 183
    PHP Notice:  Undefined index: adv_awc in /path/to/wp-content/plugins/awin-advertiser-tracking/awin-advertiser-tracking.php on line 226
    PHP Notice:  Undefined index: source in /path/to/wp-content/plugins/awin-advertiser-tracking/awin-advertiser-tracking.php on line 226
    

    awin-advertiser-tracking.php:183 is

    
    $source = $_COOKIE[AWIN_SOURCE_COOKIE_NAME];
    $channel = strlen($source) > 0 ? $source : 'aw';
    

    which I think should be replaced with:

    
    $channel = filter_input( INPUT_COOKIE, AWIN_SOURCE_COOKIE_NAME ) ?? 'aw';
    

    Although that requires PHP 7, so maybe instead:

    
    $channel = isset( $_COOKIE[AWIN_SOURCE_COOKIE_NAME] ) ? filter_input( INPUT_COOKIE, AWIN_SOURCE_COOKIE_NAME ) : 'aw';
    

    awin-advertiser-tracking.php:226 is

    
    awin_perform_server_to_server_call($_COOKIE[AWIN_AWC_COOKIE_NAME], $_COOKIE[AWIN_SOURCE_COOKIE_NAME], $order, $advertiserId, $voucher);
    

    to:

    
    $awc = isset( $_COOKIE[AWIN_AWC_COOKIE_NAME] ) ? filter_var( INPUT_COOKIE, AWIN_AWC_COOKIE_NAME ) : '';
    $source = isset( $_COOKIE[AWIN_SOURCE_COOKIE_NAME] ) ? filter_var( INPUT_COOKIE, AWIN_SOURCE_COOKIE_NAME ) : '';
    
    awin_perform_server_to_server_call( $awc, $source, $order, $advertiserId, $voucher);    
    

    I’d also consider giving this a more unique name:

    
    define( 'AWIN_SOURCE_COOKIE_NAME', 'source' );
    
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Brian Henry

    (@brianhenryie)

    Also:

    PHP Deprecated: get_used_coupons is <strong>deprecated</strong> since version 3.7! Use WC_Abstract_Order::get_coupon_codes instead. in /path/to/wp-includes/functions.php on line 4859

    
    #0 /path/to/wp-includes/class-wp-hook.php(287): BH\includes\Functions->log_deprecated_functions_only_once_per_day('get_used_coupon...', 'WC_Abstract_Ord...', '3.7')
    #1 /path/to/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters('', Array)
    #2 /path/to/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
    #3 /path/to/wp-includes/functions.php(4839): do_action('deprecated_func...', 'get_used_coupon...', 'WC_Abstract_Ord...', '3.7')
    #4 /path/to/wp-content/plugins/woocommerce/includes/wc-deprecated-functions.php(54): _deprecated_function('get_used_coupon...', '3.7', 'WC_Abstract_Ord...')
    #5 /path/to/wp-content/plugins/woocommerce/includes/legacy/abstract-wc-legacy-order.php(609): wc_deprecated_function('get_used_coupon...', '3.7', 'WC_Abstract_Ord...')
    
    #6 /path/to/wp-content/plugins/awin-advertiser-tracking/awin-advertiser-tracking.php(172): WC_Abstract_Legacy_Order->get_used_coupons()
    
    #7 /path/to/wp-includes/class-wp-hook.php(287): awin_thank_you(60812)
    #8 /path/to/wp-includes/class-wp-hook.php(311): WP_Hook->apply_filters(NULL, Array)
    #9 /path/to/wp-includes/plugin.php(484): WP_Hook->do_action(Array)
    #10 /path/to/wp-content/themes/enhanced/woocommerce/checkout/thankyou.php(82): do_action('woocommerce_tha...', 60812)
    

    Change line 172 from:
    $coupons = $order->get_used_coupons();
    to
    $coupons = $order->get_coupon_codes();

    Thread Starter Brian Henry

    (@brianhenryie)

    The latter part of the first post (~line 226) should use filter_input rather than filter_var.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Notice: Undefined index’ is closed to new replies.