From 6bb818b2a9f93701d2e67cb2628ffd9bb00ffaca Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Mon, 22 Jun 2026 10:31:24 -0400 Subject: [PATCH 01/12] Update workflow to support multiple OS environments --- .github/workflows/test.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90b57ca..74e671e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,7 +8,8 @@ jobs: fail-fast: false matrix: php: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5] - runs-on: ubuntu-latest + os: [ubuntu-latest, windows-latest, macos-latest] + runs-on: ${{ matrix.os }} steps: - name: Checkout repository uses: actions/checkout@v4 From 39d0eddc4ab6d240da4c8df3641a538b18cdafab Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Jun 2026 14:39:04 +0000 Subject: [PATCH 02/12] Quote PHP matrix versions in test workflow --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 74e671e..90b1e48 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ jobs: strategy: fail-fast: false matrix: - php: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5] + php: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} steps: From 067e12628bfe3b0932b0c1fee26e54374321f12d Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Mon, 22 Jun 2026 10:48:26 -0400 Subject: [PATCH 03/12] Add pdo_sqlite extension to PHP setup --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 90b1e48..a8b0edc 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: curl, mbstring + extensions: curl, mbstring, pdo_sqlite tools: composer:v2 - run: composer install - run: composer test From 9afa64eb97a059f91eb908c5e2a12f6978e93009 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Mon, 22 Jun 2026 10:52:51 -0400 Subject: [PATCH 04/12] Add 'fileinfo' extension to PHP setup --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a8b0edc..8c84c36 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -18,7 +18,7 @@ jobs: - uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: curl, mbstring, pdo_sqlite + extensions: curl, mbstring, pdo_sqlite, fileinfo tools: composer:v2 - run: composer install - run: composer test From a1faf4f00b9f3e98c9bacf3eecda43bd13ac23aa Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Mon, 22 Jun 2026 11:52:46 -0400 Subject: [PATCH 05/12] fix: Failed asserting that exception message 'Target directory is not writable' contains 'Invalid target path: contains directory traversal'. --- flight/net/UploadedFile.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/flight/net/UploadedFile.php b/flight/net/UploadedFile.php index 61b4697..5fc10d0 100644 --- a/flight/net/UploadedFile.php +++ b/flight/net/UploadedFile.php @@ -131,14 +131,15 @@ public function moveTo(string $targetPath): void throw new Exception($this->getUploadErrorMessage($this->error)); } - if (is_writeable(dirname($targetPath)) === false) { - throw new Exception('Target directory is not writable'); - } - // Prevent path traversal attacks if (strpos($targetPath, '..') !== false) { throw new Exception('Invalid target path: contains directory traversal'); } + + if (is_writeable(dirname($targetPath)) === false) { + throw new Exception('Target directory is not writable'); + } + // Prevent absolute paths (basic check for Unix/Windows) if ($targetPath[0] === '/' || (strlen($targetPath) > 1 && $targetPath[1] === ':')) { throw new Exception('Invalid target path: absolute paths not allowed'); From 237d5673736e1c24fc37ec0c12083f5a877656bd Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Mon, 22 Jun 2026 11:53:26 -0400 Subject: [PATCH 06/12] fix: symlink(): Permission denied on WINNT --- tests/UploadedFileTest.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/UploadedFileTest.php b/tests/UploadedFileTest.php index 1085e9b..752780d 100644 --- a/tests/UploadedFileTest.php +++ b/tests/UploadedFileTest.php @@ -114,6 +114,10 @@ public function testMoveToOverwrite(): void public function testMoveToSymlinkNonPost(): void { + if (PHP_OS === 'WINNT') { + $this->markTestSkipped('Symbolic links require special privileges on Windows.'); + } + file_put_contents('real_file', 'test'); if (file_exists('tmp_symlink')) { unlink('tmp_symlink'); From 76aaf5e27450d12dfd6fbd10bf3d28024dcd298e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Jun 2026 20:01:38 +0000 Subject: [PATCH 07/12] Fix Windows CI failure in testGetRoutes: replace both \\r\\n and \\n newlines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit On Windows, PHP_EOL is \\r\\n but the CLI library writes \\n to the output file. The removeColors() helper converts \\r\\nโ†’\\n, so using str_replace(PHP_EOL, '') afterwards failed to strip those \\n on Windows, leaving newlines in the haystack while the needle had none. Fix: replace both \\r\\n and \\n so all newline variants are stripped from both needle and haystack before comparison, making the test platform-independent. --- tests/commands/RouteCommandTest.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/commands/RouteCommandTest.php b/tests/commands/RouteCommandTest.php index 3aea0b1..26a8ba0 100644 --- a/tests/commands/RouteCommandTest.php +++ b/tests/commands/RouteCommandTest.php @@ -123,8 +123,8 @@ public function testGetRoutes(): void output; // phpcs:ignore $this->assertStringContainsString( - str_replace(PHP_EOL, '', $expected), - str_replace(PHP_EOL, '', $this->removeColors(file_get_contents(static::$ou))), + str_replace(["\r\n", "\n"], '', $expected), + str_replace(["\r\n", "\n"], '', $this->removeColors(file_get_contents(static::$ou))), ); } From 8b5118b791a06b012d92b300ba58ee079e82cad2 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Mon, 22 Jun 2026 16:48:44 -0400 Subject: [PATCH 08/12] Fix another endlines problems with windows --- tests/ViewTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/ViewTest.php b/tests/ViewTest.php index 54a0939..e57afd0 100644 --- a/tests/ViewTest.php +++ b/tests/ViewTest.php @@ -102,9 +102,13 @@ public function testTemplateWithCustomExtension(): void $this->view->set('name', 'Bob'); $this->view->extension = '.html'; + ob_start(); $this->view->render('world'); + $html = ob_get_clean(); + $html = str_replace(["\r\n", "\n"], '', $html); + echo $html; - $this->expectOutputString("Hello world, Bob!\n"); + $this->expectOutputString("Hello world, Bob!"); } public function testGetTemplateAbsolutePath(): void From a8de8d39147a4091700155b74a7caeef0262d3fd Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Mon, 22 Jun 2026 16:51:55 -0400 Subject: [PATCH 09/12] Fix testRenderLayout in windows --- tests/RenderTest.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/RenderTest.php b/tests/RenderTest.php index ab71965..96203fb 100644 --- a/tests/RenderTest.php +++ b/tests/RenderTest.php @@ -29,8 +29,12 @@ public function testRenderView(): void public function testRenderLayout(): void { $this->app->render('hello', ['name' => 'Bob'], 'content'); + ob_start(); $this->app->render('layouts/layout'); + $html = ob_get_clean(); + $html = str_replace(["\r\n", "\n"], '', $html); + echo $html; - $this->expectOutputString("Hello, Bob!\n"); + $this->expectOutputString("Hello, Bob!"); } } From 4e8402ece0f0c77c55b28ea4494830faea6c5637 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Mon, 22 Jun 2026 16:56:12 -0400 Subject: [PATCH 10/12] Fix pdoexception message in php8.0 in windows --- tests/SimplePdoTest.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/SimplePdoTest.php b/tests/SimplePdoTest.php index eb6d16d..4e97dd7 100644 --- a/tests/SimplePdoTest.php +++ b/tests/SimplePdoTest.php @@ -171,9 +171,9 @@ public function testFetchRowDoesNotAddLimitAfterReturningClause(): void $this->assertInstanceOf(Collection::class, $row); $this->assertSame('Alice', $row['name']); } catch (PDOException $exception) { - $this->assertSame( - 'Prepare failed: near "RETURNING": syntax error', - $exception->getMessage(), + $this->assertStringContainsString( + 'near "returning": syntax error', + strtolower($exception->getMessage()), ); } } From b068acae845b981a8b802f44928084a91c8c251f Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Mon, 22 Jun 2026 17:09:45 -0400 Subject: [PATCH 11/12] workflow refactor --- .github/workflows/test.yml | 9 +++++---- composer.json | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8c84c36..c0eb8d1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,13 +12,14 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 0 - uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} - extensions: curl, mbstring, pdo_sqlite, fileinfo + extensions: mbstring, pdo_sqlite, fileinfo tools: composer:v2 - - run: composer install - - run: composer test + - run: | + composer install --no-progress --no-ansi -n + composer test -- --colors=never --no-interaction diff --git a/composer.json b/composer.json index 33d2951..30ccfca 100644 --- a/composer.json +++ b/composer.json @@ -45,6 +45,8 @@ } }, "require-dev": { + "ext-mbstring": "*", + "ext-fileinfo": "*", "ext-pdo_sqlite": "*", "flightphp/container": "^1.3", "flightphp/runway": "^1.2", From 82430882f0cb9cab23face35728513fc8e14ee97 Mon Sep 17 00:00:00 2001 From: fadrian06 Date: Mon, 22 Jun 2026 17:19:30 -0400 Subject: [PATCH 12/12] decorate workflow --- .github/workflows/test.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c0eb8d1..3bea429 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,9 @@ -name: Pull Request Check +name: ๐Ÿš€ Pull Request Check ๐Ÿ” on: [pull_request] jobs: unit-test: - name: Unit testing + name: ๐Ÿงช Unit Testing - PHP ${{ matrix.php }} on ${{ matrix.os }} strategy: fail-fast: false matrix: @@ -11,15 +11,17 @@ jobs: os: [ubuntu-latest, windows-latest, macos-latest] runs-on: ${{ matrix.os }} steps: - - name: Checkout repository + - name: ๐Ÿ“‚ Checkout repository uses: actions/checkout@v6 with: fetch-depth: 0 - - uses: shivammathur/setup-php@v2 + - name: ๐Ÿ˜ Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} extensions: mbstring, pdo_sqlite, fileinfo tools: composer:v2 - - run: | + - name: ๐Ÿ“ฆ Install dependencies and ๐Ÿงช Run tests + run: | composer install --no-progress --no-ansi -n composer test -- --colors=never --no-interaction