From b7028cec5fadd0f58e7edee82b8f9e538902ea69 Mon Sep 17 00:00:00 2001 From: Jonathan Desrosiers Date: Mon, 15 Sep 2025 13:04:59 -0400 Subject: [PATCH] Revert changes in #264 --- report.php | 7 +++---- test.php | 8 +++----- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/report.php b/report.php index cec931e..4265db0 100644 --- a/report.php +++ b/report.php @@ -49,8 +49,7 @@ * safely used in shell commands. */ log_message('Copying junit.xml results'); -$junit_location = $runner_vars['WPT_TEST_DIR'] . '/tests/phpunit/build/logs/*'; - +$junit_location = escapeshellarg( $runner_vars['WPT_TEST_DIR'] ) . '/tests/phpunit/build/logs/*'; /** * Modifies the junit.xml results file path for a remote location if an SSH connection is available. * If the WPT_SSH_CONNECT environment variable is not empty, indicating that an SSH connection @@ -58,8 +57,8 @@ * command and options for accessing the remote file system. It concatenates SSH options with the * remote path to ensure that the junit.xml results can be accessed or copied over SSH. */ -if ( ! empty( $WPT_SSH_CONNECT ) ) { - $junit_location = '-e "ssh ' . $runner_vars['WPT_SSH_OPTIONS'] . '" ' . escapeshellarg( $runner_vars['WPT_SSH_CONNECT'] ) . ':' . escapeshellarg( $junit_location ); +if ( ! empty( $runner_vars['WPT_SSH_CONNECT'] ) ) { + $junit_location = '-e "ssh ' . $runner_vars['WPT_SSH_OPTIONS'] . '" ' . escapeshellarg( $runner_vars['WPT_SSH_CONNECT'] . ':' . $junit_location ); } /** diff --git a/test.php b/test.php index b78ec14..c2b56c7 100644 --- a/test.php +++ b/test.php @@ -65,15 +65,13 @@ * avoid reporting useless tests. */ $WPT_PHPUNIT_CMD = trim( getenv( 'WPT_PHPUNIT_CMD' ) ); -if ( empty( $WPT_PHPUNIT_CMD ) ) { - $WPT_PHPUNIT_CMD = escapeshellarg( 'cd ' . $runner_vars['WPT_TEST_DIR'] . ' && ' . $runner_vars['WPT_PHP_EXECUTABLE'] . ' ./vendor/phpunit/phpunit/phpunit --dont-report-useless-tests' . $WPT_FLAVOR_TXT . $WPT_EXTRATESTS_TXT ); -} else { - $WPT_PHPUNIT_CMD = escapeshellarg( $WPT_PHPUNIT_CMD ); +if( empty( $WPT_PHPUNIT_CMD ) ) { + $WPT_PHPUNIT_CMD = 'cd ' . escapeshellarg( $runner_vars['WPT_TEST_DIR'] ) . ' && ' . $runner_vars['WPT_PHP_EXECUTABLE'] . ' ./vendor/phpunit/phpunit/phpunit --dont-report-useless-tests' . $WPT_FLAVOR_TXT . $WPT_EXTRATESTS_TXT; } // If an SSH connection string is provided, prepend the SSH command to the PHPUnit execution command. if ( ! empty( $runner_vars['WPT_SSH_CONNECT'] ) ) { - $WPT_PHPUNIT_CMD = 'ssh ' . $runner_vars['WPT_SSH_OPTIONS'] . ' ' . escapeshellarg( $runner_vars['WPT_SSH_CONNECT'] ) . ' ' . $WPT_PHPUNIT_CMD; + $WPT_PHPUNIT_CMD = 'ssh ' . $runner_vars['WPT_SSH_OPTIONS'] . ' ' . escapeshellarg( $runner_vars['WPT_SSH_CONNECT'] ) . ' ' . escapeshellarg( $WPT_PHPUNIT_CMD ); } // Execute the PHPUnit command.