PHP Notice: Undefined index
-
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
isawin_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)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘PHP Notice: Undefined index’ is closed to new replies.