From 1e66b55e385a214e611b482f6a8f362d806b9916 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 11:57:56 +0100 Subject: [PATCH 01/12] Reproduce bug 10483 --- .github/workflows/other-tests.yml | 7 +++++++ e2e/bug10483/bootstrap.php | 4 ++++ e2e/bug10483/phpstan.dist.neon | 7 +++++++ e2e/bug10483/src/bug10483.php | 10 ++++++++++ 4 files changed, 28 insertions(+) create mode 100644 e2e/bug10483/bootstrap.php create mode 100644 e2e/bug10483/phpstan.dist.neon create mode 100644 e2e/bug10483/src/bug10483.php diff --git a/.github/workflows/other-tests.yml b/.github/workflows/other-tests.yml index 059020364a..359caae1a3 100644 --- a/.github/workflows/other-tests.yml +++ b/.github/workflows/other-tests.yml @@ -407,6 +407,13 @@ jobs: ../../phpstan clear-result-cache -q ../../phpstan analyse --generate-baseline -q ../../phpstan analyse -vvv --fail-without-result-cache + - php-version: 8.2 + ini-values: memory_limit=256M + extensions: none + operating-system: ubuntu-latest + script: | + cd e2e/bug10483 + ../../phpstan analyze steps: - name: "Checkout" diff --git a/e2e/bug10483/bootstrap.php b/e2e/bug10483/bootstrap.php new file mode 100644 index 0000000000..39151c0c26 --- /dev/null +++ b/e2e/bug10483/bootstrap.php @@ -0,0 +1,4 @@ + FILTER_VALIDATE_INT, + 'positive_int' => $filter, + ], true); + + var_dump($x); +} From f3babd961ad634a528c9652f2fe1c3f466eb4426 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 12:02:18 +0100 Subject: [PATCH 02/12] Update other-tests.yml --- .github/workflows/other-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/other-tests.yml b/.github/workflows/other-tests.yml index 359caae1a3..8ab94b79b3 100644 --- a/.github/workflows/other-tests.yml +++ b/.github/workflows/other-tests.yml @@ -409,7 +409,7 @@ jobs: ../../phpstan analyse -vvv --fail-without-result-cache - php-version: 8.2 ini-values: memory_limit=256M - extensions: none + extensions: none, mbstring operating-system: ubuntu-latest script: | cd e2e/bug10483 From 92b30b1589978c4fef64543eb1853b761af113e9 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 12:05:29 +0100 Subject: [PATCH 03/12] Update other-tests.yml --- .github/workflows/other-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/other-tests.yml b/.github/workflows/other-tests.yml index 8ab94b79b3..9da1048ba6 100644 --- a/.github/workflows/other-tests.yml +++ b/.github/workflows/other-tests.yml @@ -409,7 +409,7 @@ jobs: ../../phpstan analyse -vvv --fail-without-result-cache - php-version: 8.2 ini-values: memory_limit=256M - extensions: none, mbstring + extensions: :filter operating-system: ubuntu-latest script: | cd e2e/bug10483 From 9505305ddde17e383b895de34f80e154e2a564f2 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 12:08:04 +0100 Subject: [PATCH 04/12] Update bug10483.php --- e2e/bug10483/src/bug10483.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/bug10483/src/bug10483.php b/e2e/bug10483/src/bug10483.php index 4b4f70d292..367a8142a2 100644 --- a/e2e/bug10483/src/bug10483.php +++ b/e2e/bug10483/src/bug10483.php @@ -1,6 +1,6 @@ FILTER_VALIDATE_INT, 'positive_int' => $filter, From 47fb4bde89fcc80db930757da627f6b3272245aa Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 12:09:12 +0100 Subject: [PATCH 05/12] Update other-tests.yml --- .github/workflows/other-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/other-tests.yml b/.github/workflows/other-tests.yml index 9da1048ba6..ff4a6ec180 100644 --- a/.github/workflows/other-tests.yml +++ b/.github/workflows/other-tests.yml @@ -409,7 +409,7 @@ jobs: ../../phpstan analyse -vvv --fail-without-result-cache - php-version: 8.2 ini-values: memory_limit=256M - extensions: :filter + extensions: none, tokenizer, mbstring operating-system: ubuntu-latest script: | cd e2e/bug10483 From a90c47fd3cc479ee9088f1793698affb040bfe53 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 12:19:56 +0100 Subject: [PATCH 06/12] different const --- e2e/bug10483/bootstrap.php | 2 +- e2e/bug10483/src/bug10483.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/bug10483/bootstrap.php b/e2e/bug10483/bootstrap.php index 39151c0c26..ceaa8d93b5 100644 --- a/e2e/bug10483/bootstrap.php +++ b/e2e/bug10483/bootstrap.php @@ -1,4 +1,4 @@ FILTER_VALIDATE_INT, + 'int' => FILTER_SANITIZE_MAGIC_QUOTES, 'positive_int' => $filter, ], true); From 8df5c4e2db10baf88f26966685c28e7250131f5c Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 12:41:56 +0100 Subject: [PATCH 07/12] use FILTER_VALIDATE_BOOL --- .github/workflows/other-tests.yml | 2 +- e2e/bug10483/bootstrap.php | 5 +++-- e2e/bug10483/src/bug10483.php | 5 +---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/other-tests.yml b/.github/workflows/other-tests.yml index ff4a6ec180..12eab8c8c7 100644 --- a/.github/workflows/other-tests.yml +++ b/.github/workflows/other-tests.yml @@ -407,7 +407,7 @@ jobs: ../../phpstan clear-result-cache -q ../../phpstan analyse --generate-baseline -q ../../phpstan analyse -vvv --fail-without-result-cache - - php-version: 8.2 + - php-version: 7.4 ini-values: memory_limit=256M extensions: none, tokenizer, mbstring operating-system: ubuntu-latest diff --git a/e2e/bug10483/bootstrap.php b/e2e/bug10483/bootstrap.php index ceaa8d93b5..b33e04c1f1 100644 --- a/e2e/bug10483/bootstrap.php +++ b/e2e/bug10483/bootstrap.php @@ -1,4 +1,5 @@ FILTER_SANITIZE_MAGIC_QUOTES, - 'positive_int' => $filter, + 'int' => FILTER_VALIDATE_BOOL ], true); - - var_dump($x); } From b032afab4a5134fb405473efde48e3e805acc7ce Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 12:42:20 +0100 Subject: [PATCH 08/12] Update bootstrap.php --- e2e/bug10483/bootstrap.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2e/bug10483/bootstrap.php b/e2e/bug10483/bootstrap.php index b33e04c1f1..c8dd173f12 100644 --- a/e2e/bug10483/bootstrap.php +++ b/e2e/bug10483/bootstrap.php @@ -2,4 +2,4 @@ // constant that's used in the Filter extension that was introduced in a later version of PHP. // on earlier php version introduce the same constant via a bootstrap file but with a wrong type -if(!defined("FILTER_VALIDATE_BOOL"))define("FILTER_VALIDATE_BOOL ",false); +if(!defined("FILTER_VALIDATE_BOOL"))define("FILTER_VALIDATE_BOOL",false); From 235d936528dd9bc52735a7d09babffe06ca50601 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 12:45:23 +0100 Subject: [PATCH 09/12] Update other-tests.yml --- .github/workflows/other-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/other-tests.yml b/.github/workflows/other-tests.yml index 12eab8c8c7..5e4713417f 100644 --- a/.github/workflows/other-tests.yml +++ b/.github/workflows/other-tests.yml @@ -409,7 +409,6 @@ jobs: ../../phpstan analyse -vvv --fail-without-result-cache - php-version: 7.4 ini-values: memory_limit=256M - extensions: none, tokenizer, mbstring operating-system: ubuntu-latest script: | cd e2e/bug10483 From 8a45f0a3957d873336e331351d3f17b9fb05a175 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 13:02:13 +0100 Subject: [PATCH 10/12] try FILTER_SANITIZE_ADD_SLASHES --- .github/workflows/other-tests.yml | 2 +- e2e/bug10483/bootstrap.php | 2 +- e2e/bug10483/src/bug10483.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/other-tests.yml b/.github/workflows/other-tests.yml index 5e4713417f..1e697a55b0 100644 --- a/.github/workflows/other-tests.yml +++ b/.github/workflows/other-tests.yml @@ -407,7 +407,7 @@ jobs: ../../phpstan clear-result-cache -q ../../phpstan analyse --generate-baseline -q ../../phpstan analyse -vvv --fail-without-result-cache - - php-version: 7.4 + - php-version: 7.2 ini-values: memory_limit=256M operating-system: ubuntu-latest script: | diff --git a/e2e/bug10483/bootstrap.php b/e2e/bug10483/bootstrap.php index c8dd173f12..23a9d292e4 100644 --- a/e2e/bug10483/bootstrap.php +++ b/e2e/bug10483/bootstrap.php @@ -2,4 +2,4 @@ // constant that's used in the Filter extension that was introduced in a later version of PHP. // on earlier php version introduce the same constant via a bootstrap file but with a wrong type -if(!defined("FILTER_VALIDATE_BOOL"))define("FILTER_VALIDATE_BOOL",false); +if(!defined("FILTER_SANITIZE_ADD_SLASHES"))define("FILTER_SANITIZE_ADD_SLASHES",false); diff --git a/e2e/bug10483/src/bug10483.php b/e2e/bug10483/src/bug10483.php index fab2380d68..14a05a5faf 100644 --- a/e2e/bug10483/src/bug10483.php +++ b/e2e/bug10483/src/bug10483.php @@ -2,6 +2,6 @@ function doFoo(mixed $filter): void { $x = filter_input_array(INPUT_GET, [ - 'int' => FILTER_VALIDATE_BOOL + 'int' => FILTER_SANITIZE_ADD_SLASHES ], true); } From 0e4cc9f2b798dd51a3bb437b5314d66a423aade9 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 13:07:33 +0100 Subject: [PATCH 11/12] revert --- e2e/bug10483/bootstrap.php | 2 +- e2e/bug10483/src/bug10483.php | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/e2e/bug10483/bootstrap.php b/e2e/bug10483/bootstrap.php index 23a9d292e4..c8dd173f12 100644 --- a/e2e/bug10483/bootstrap.php +++ b/e2e/bug10483/bootstrap.php @@ -2,4 +2,4 @@ // constant that's used in the Filter extension that was introduced in a later version of PHP. // on earlier php version introduce the same constant via a bootstrap file but with a wrong type -if(!defined("FILTER_SANITIZE_ADD_SLASHES"))define("FILTER_SANITIZE_ADD_SLASHES",false); +if(!defined("FILTER_VALIDATE_BOOL"))define("FILTER_VALIDATE_BOOL",false); diff --git a/e2e/bug10483/src/bug10483.php b/e2e/bug10483/src/bug10483.php index 14a05a5faf..5b2d5a883f 100644 --- a/e2e/bug10483/src/bug10483.php +++ b/e2e/bug10483/src/bug10483.php @@ -1,7 +1,5 @@ FILTER_SANITIZE_ADD_SLASHES - ], true); + var_dump(filter_var("no", FILTER_VALIDATE_BOOL)); } From 4629238b07c8de432ed677faf19e7f0a5b668b72 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Fri, 1 Mar 2024 14:57:05 +0100 Subject: [PATCH 12/12] fix --- e2e/bug10483/bootstrap.php | 2 +- e2e/bug10483/src/bug10483.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/bug10483/bootstrap.php b/e2e/bug10483/bootstrap.php index c8dd173f12..23a9d292e4 100644 --- a/e2e/bug10483/bootstrap.php +++ b/e2e/bug10483/bootstrap.php @@ -2,4 +2,4 @@ // constant that's used in the Filter extension that was introduced in a later version of PHP. // on earlier php version introduce the same constant via a bootstrap file but with a wrong type -if(!defined("FILTER_VALIDATE_BOOL"))define("FILTER_VALIDATE_BOOL",false); +if(!defined("FILTER_SANITIZE_ADD_SLASHES"))define("FILTER_SANITIZE_ADD_SLASHES",false); diff --git a/e2e/bug10483/src/bug10483.php b/e2e/bug10483/src/bug10483.php index 5b2d5a883f..d1cd04c5d6 100644 --- a/e2e/bug10483/src/bug10483.php +++ b/e2e/bug10483/src/bug10483.php @@ -1,5 +1,5 @@