From 001c47c992ddd829a289470d7675720208d7e3ba Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 Jan 2026 10:25:37 +0000 Subject: [PATCH 1/2] Initial plan From 8f7c4996482020f445d0ce85a0e2a571624ff7fd Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 20 Jan 2026 10:32:54 +0000 Subject: [PATCH 2/2] Add validation for ref variable to prevent undefined usage Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com> --- templates/install-wp-tests.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/templates/install-wp-tests.sh b/templates/install-wp-tests.sh index 4be2f528..ecae39f9 100644 --- a/templates/install-wp-tests.sh +++ b/templates/install-wp-tests.sh @@ -169,6 +169,11 @@ install_test_suite() { archive_url="https://github.com/WordPress/wordpress-develop/archive/refs/tags/${ref}.tar.gz" fi + if [ -z "$ref" ]; then + echo -e "${RED}Error:${RESET} Unable to determine git reference from WP_TESTS_TAG: $WP_TESTS_TAG" + exit 1 + fi + download "${archive_url}" "$TMPDIR/wordpress-develop.tar.gz" # Validate that the tarball was downloaded correctly before extracting @@ -201,6 +206,12 @@ install_test_suite() { else ref=${WP_TESTS_TAG#tags/} fi + + if [ -z "$ref" ]; then + echo -e "${RED}Error:${RESET} Unable to determine git reference from WP_TESTS_TAG: $WP_TESTS_TAG" + exit 1 + fi + download https://raw.githubusercontent.com/WordPress/wordpress-develop/${ref}/wp-tests-config-sample.php "$WP_TESTS_DIR"/wp-tests-config.php # remove all forward slashes in the end WP_CORE_DIR=$(echo $WP_CORE_DIR | sed "s:/\+$::")