Describe the bug
I have encountered a variable scoping issue in the job_application_email_add_shortcodes function within the includes/wp-job-manager-applications-functions.php file.
This issue leads to unexpected behavior due to a conflict between the function parameter $data and a loop variable named $data. The conflict causes incorrect variable values setting the function-level data variable to the last loop iteration value.
To Reproduce
Activate the WP Job Manager Applications plugin.
Execute the job_application_email_add_shortcodes function within the functions.php file of an active theme (add_action( 'job_application_email_add_shortcodes', 'sample_function_name');).
Observe that the loop variable $data conflicts with the function parameter $data, leading to modified $data values inside the action.
Screenshots
Expected behavior
I expected the job_application_email_add_shortcodes function to pass the original function-scope $data variable without conflicts.
Isolating the problem (mark completed items with an [x]):
[x] I have deactivated other plugins and confirmed this bug occurs when only WP Job Manager plugin is active.
[x] This bug happens with a default WordPress theme active.
[x] I can reproduce this bug consistently using the steps above.
Describe the bug I have encountered a variable scoping issue in the
job_application_email_add_shortcodes
function within theincludes/wp-job-manager-applications-functions.php
file. This issue leads to unexpected behavior due to a conflict between the function parameter$data
and a loop variable named$data
. The conflict causes incorrect variable values setting the function-leveldata
variable to the last loop iteration value.To Reproduce
job_application_email_add_shortcodes
function within thefunctions.php
file of an active theme (add_action( 'job_application_email_add_shortcodes', 'sample_function_name');
).$data
conflicts with the function parameter$data
, leading to modified$data
values inside the action.Screenshots
Expected behavior I expected the
job_application_email_add_shortcodes
function to pass the original function-scope$data
variable without conflicts.Isolating the problem (mark completed items with an [x]):
WordPress Environment