From 8cf02b6384c975ed4295bd7c64522307bff69498 Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Fri, 6 Aug 2021 10:24:20 +0200 Subject: [PATCH 01/14] Test the codebase against php 8.1 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1fa9e1a3..c1f7adef7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: timeout-minutes: 15 strategy: matrix: - php: [ '8.0', '7.4', '7.3' ] + php: [ '8.1', '8.0', '7.4', '7.3' ] dependency-version: [ '' ] include: - php: '7.3' From e38930625a2d821fe94b010949d8f6c4f01b2f4f Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Fri, 6 Aug 2021 11:18:34 +0200 Subject: [PATCH 02/14] Debug --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1f7adef7..b85d6558d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,9 @@ jobs: env: version: ${{ matrix.php }} run: | - sudo apt-get install -y php$version-fpm + # sudo apt-get install -y php$version-fpm + whereis php + which php sudo cp /usr/sbin/php-fpm$version /usr/bin/php-fpm # copy to /usr/bin echo 'expose_php=1' | sudo tee -a /etc/php/$version/fpm/php.ini - name: Install dependencies From bc0e9aa083a538c25b9b7b4ab8670d3aebd15745 Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Fri, 6 Aug 2021 11:24:57 +0200 Subject: [PATCH 03/14] Debug --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b85d6558d..816443d80 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -43,6 +43,8 @@ jobs: # sudo apt-get install -y php$version-fpm whereis php which php + whereis php-fpm + php-fpm -v sudo cp /usr/sbin/php-fpm$version /usr/bin/php-fpm # copy to /usr/bin echo 'expose_php=1' | sudo tee -a /etc/php/$version/fpm/php.ini - name: Install dependencies From 0938e4a1a797fe3a2697df7dd3a778a00a661240 Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Fri, 6 Aug 2021 11:27:40 +0200 Subject: [PATCH 04/14] FPM apprently already installed --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 816443d80..bca2ce3c8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,7 +45,7 @@ jobs: which php whereis php-fpm php-fpm -v - sudo cp /usr/sbin/php-fpm$version /usr/bin/php-fpm # copy to /usr/bin + # sudo cp /usr/sbin/php-fpm$version /usr/bin/php-fpm # copy to /usr/bin echo 'expose_php=1' | sudo tee -a /etc/php/$version/fpm/php.ini - name: Install dependencies run: 'composer update ${{ matrix.dependency-version }} --no-interaction --prefer-dist --no-progress' From 54403dc1bc314652b0f9d3742e0de2fab69b8466 Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Sat, 7 Aug 2021 11:27:58 +0200 Subject: [PATCH 05/14] Remove ini instruction --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bca2ce3c8..1d438a5d4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,8 +45,9 @@ jobs: which php whereis php-fpm php-fpm -v + php -i | grep ini # sudo cp /usr/sbin/php-fpm$version /usr/bin/php-fpm # copy to /usr/bin - echo 'expose_php=1' | sudo tee -a /etc/php/$version/fpm/php.ini + # echo 'expose_php=1' | sudo tee -a /etc/php/$version/fpm/php.ini - name: Install dependencies run: 'composer update ${{ matrix.dependency-version }} --no-interaction --prefer-dist --no-progress' - name: Execute Unit Tests From 32bf7b537e48e00c25eac6770269c984b1eb5cc5 Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Sat, 7 Aug 2021 11:35:30 +0200 Subject: [PATCH 06/14] ignore php platform reqs --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d438a5d4..17b27ee61 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -49,7 +49,7 @@ jobs: # sudo cp /usr/sbin/php-fpm$version /usr/bin/php-fpm # copy to /usr/bin # echo 'expose_php=1' | sudo tee -a /etc/php/$version/fpm/php.ini - name: Install dependencies - run: 'composer update ${{ matrix.dependency-version }} --no-interaction --prefer-dist --no-progress' + run: 'composer update ${{ matrix.dependency-version }} --no-interaction --prefer-dist --no-progress --ignore-platform-req=php' - name: Execute Unit Tests run: 'vendor/bin/phpunit --testsuite small' From 31c352b3c12cde8ab73e07a7b31d66ca27e99708 Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Sat, 7 Aug 2021 11:38:35 +0200 Subject: [PATCH 07/14] test only 8.1 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17b27ee61..135f9db3f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: timeout-minutes: 15 strategy: matrix: - php: [ '8.1', '8.0', '7.4', '7.3' ] + php: [ '8.1' ] dependency-version: [ '' ] include: - php: '7.3' From a6a039d62bb868d7d5cd261c426da5cf0e24725a Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Sat, 7 Aug 2021 11:41:53 +0200 Subject: [PATCH 08/14] disable fail fast --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 135f9db3f..b1694c800 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,9 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 strategy: + fail-fast: false matrix: - php: [ '8.1' ] + php: [ '8.1', '8.0', '7.4', '7.3' ] dependency-version: [ '' ] include: - php: '7.3' From 631f9992495747bf1240c2baa3e56b9bf3bef8b8 Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Sat, 7 Aug 2021 11:47:19 +0200 Subject: [PATCH 09/14] avoid fpm setup on 8.1 --- .github/workflows/ci.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b1694c800..2b718556e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,17 +38,13 @@ jobs: ini-values: expose_php=1 # See https://github.com/shivammathur/setup-php/issues/280 - name: Setup php-fpm + if: ${{ matrix.php != '8.1' }} env: version: ${{ matrix.php }} run: | - # sudo apt-get install -y php$version-fpm - whereis php - which php - whereis php-fpm - php-fpm -v - php -i | grep ini - # sudo cp /usr/sbin/php-fpm$version /usr/bin/php-fpm # copy to /usr/bin - # echo 'expose_php=1' | sudo tee -a /etc/php/$version/fpm/php.ini + sudo apt-get install -y php$version-fpm + sudo cp /usr/sbin/php-fpm$version /usr/bin/php-fpm # copy to /usr/bin + echo 'expose_php=1' | sudo tee -a /etc/php/$version/fpm/php.ini - name: Install dependencies run: 'composer update ${{ matrix.dependency-version }} --no-interaction --prefer-dist --no-progress --ignore-platform-req=php' - name: Execute Unit Tests From 95782e0e35ac98d46ef52f0f4e87afa6982f6dc9 Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Sat, 7 Aug 2021 12:00:15 +0200 Subject: [PATCH 10/14] Cleanup --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b718556e..e62091237 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,9 +19,12 @@ jobs: matrix: php: [ '8.1', '8.0', '7.4', '7.3' ] dependency-version: [ '' ] + platform-reqs: [ '' ] include: - php: '7.3' dependency-version: '--prefer-lowest' + - php: '8.1' + platform-reqs: '--ignore-platform-req=php' # see https://github.com/phpspec/prophecy/pull/533#issuecomment-891606803 steps: - name: Checkout uses: actions/checkout@v2 @@ -46,7 +49,7 @@ jobs: sudo cp /usr/sbin/php-fpm$version /usr/bin/php-fpm # copy to /usr/bin echo 'expose_php=1' | sudo tee -a /etc/php/$version/fpm/php.ini - name: Install dependencies - run: 'composer update ${{ matrix.dependency-version }} --no-interaction --prefer-dist --no-progress --ignore-platform-req=php' + run: 'composer update ${{ matrix.dependency-version }} --no-interaction --prefer-dist --no-progress ${{ matrix.platform-reqs }}' - name: Execute Unit Tests run: 'vendor/bin/phpunit --testsuite small' From 79e87066da5ebaa1b284ad84c681933187a71f0b Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Sat, 7 Aug 2021 12:03:13 +0200 Subject: [PATCH 11/14] Remove 8.1 from main matrix --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e62091237..eccaece7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,7 @@ jobs: strategy: fail-fast: false matrix: - php: [ '8.1', '8.0', '7.4', '7.3' ] + php: [ '8.0', '7.4', '7.3' ] dependency-version: [ '' ] platform-reqs: [ '' ] include: From ad4294add80407260f3de05e08ab387904a6573c Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Sat, 7 Aug 2021 12:13:55 +0200 Subject: [PATCH 12/14] Try to fix tests --- tests/Handler/FpmHandlerTest.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/Handler/FpmHandlerTest.php b/tests/Handler/FpmHandlerTest.php index 75e043070..0ec12ef62 100644 --- a/tests/Handler/FpmHandlerTest.php +++ b/tests/Handler/FpmHandlerTest.php @@ -1117,7 +1117,7 @@ private function assertGlobalVariables(array $event, array $expectedGlobalVariab // Test global variables that never change (simplifies all the tests) $response = $this->assertCommonServerVariables($response, $expectedGlobalVariables); - self::assertEquals($expectedGlobalVariables, $response); + self::assertArraySubset($expectedGlobalVariables, $response); } private function assertCommonServerVariables(array $response, array $expectedGlobalVariables): array From f101c5cb8061ccd612012c5d46ab34f6f9370d2c Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Sat, 7 Aug 2021 12:16:31 +0200 Subject: [PATCH 13/14] remove fail-fast now that everything is green --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index eccaece7b..8aacbce45 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 strategy: - fail-fast: false matrix: php: [ '8.0', '7.4', '7.3' ] dependency-version: [ '' ] From 8ae6bb1b7bfa31f6a30c344a12dac1f1dd32b1bb Mon Sep 17 00:00:00 2001 From: Thibault RICHARD Date: Mon, 16 Aug 2021 20:25:47 +0200 Subject: [PATCH 14/14] make tests stricter --- tests/Handler/FpmHandlerTest.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/tests/Handler/FpmHandlerTest.php b/tests/Handler/FpmHandlerTest.php index 0ec12ef62..2568ae53d 100644 --- a/tests/Handler/FpmHandlerTest.php +++ b/tests/Handler/FpmHandlerTest.php @@ -732,7 +732,8 @@ public function test POST request with multipart file uploads(int $version ], 'body' => $body, ]; - $this->assertGlobalVariables($event, [ + + $expectedGlobalVariables = [ '$_GET' => [], '$_POST' => [], '$_FILES' => [ @@ -742,6 +743,7 @@ public function test POST request with multipart file uploads(int $version 'error' => 0, 'size' => 57, 'content' => "Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit.\n", + 'full_path' => 'lorem.txt', ], 'bar' => [ 'name' => 'cars.csv', @@ -749,6 +751,7 @@ public function test POST request with multipart file uploads(int $version 'error' => 0, 'size' => 51, 'content' => "Year,Make,Model\n1997,Ford,E350\n2000,Mercury,Cougar\n", + 'full_path' => 'cars.csv', ], ], '$_COOKIE' => [], @@ -767,7 +770,15 @@ public function test POST request with multipart file uploads(int $version 'LAMBDA_REQUEST_CONTEXT' => '[]', ], 'HTTP_RAW_BODY' => '', - ]); + ]; + + if (\PHP_VERSION_ID < 80100) { + // full_path was introduced in PHP 8.1, remove it for lower versions + unset($expectedGlobalVariables['$_FILES']['foo']['full_path']); + unset($expectedGlobalVariables['$_FILES']['bar']['full_path']); + } + + $this->assertGlobalVariables($event, $expectedGlobalVariables); } /** @@ -1117,7 +1128,7 @@ private function assertGlobalVariables(array $event, array $expectedGlobalVariab // Test global variables that never change (simplifies all the tests) $response = $this->assertCommonServerVariables($response, $expectedGlobalVariables); - self::assertArraySubset($expectedGlobalVariables, $response); + self::assertEquals($expectedGlobalVariables, $response); } private function assertCommonServerVariables(array $response, array $expectedGlobalVariables): array