PHP Warning: Undefined array key in GoAffPro
-
Hello,
I encountered a PHP Warning in the GoAffPro plugin version 2.7.10 when using WordPress 6.9 on PHP 8.3.
File Path:
wp-content/plugins/goaffpro/goaffpro.php. The issue occurs on line 109.Warning Details (From debug.log):
PHP Warning: Undefined array key “gfp_v_id” in /var/www/website/wp-content/plugins/goaffpro/goaffpro.php on line 109Problem Description:
The code at line 109 attempts to access $_COOKIE[‘gfp_v_id’] without first checking if the key exists using isset(). This causes a warning in PHP 8.3 when the cookie is not present.Current code (line 109):
$visit_id = sanitize_text_field($_COOKIE[‘gfp_v_id’]);The same function correctly handles the ‘ref’ cookie at line 102 by checking isset($_COOKIE[‘ref’]) before accessing it. The ‘gfp_v_id’ cookie should use the same approach.
Suggested fix:
Add an isset() check before accessing $_COOKIE[‘gfp_v_id’], similar to the pattern used for the ‘ref’ cookie in the same function.Server Environment:
- PHP version: 8.3
- WordPress version: 6.9
- GoAffPro version: 2.7.10 (latest)
Request: Could you please add the missing isset() check for the ‘gfp_v_id’ cookie to prevent this warning?
Thank you for your attention to this matter.
CC https://ww.wp.xz.cn/support/topic/undefined-index-variations/
You must be logged in to reply to this topic.