Downgrade Symfony/Process

A bit messier than expected. Current version of symfony/process (used only in dev) has a security advisory. There is no version that can be upgraded to which supports Php8.0. However, a downgrade to V5 will work.

When running with Php8.4, PhpUnit references E_STRICT, which is deprecated in 8.4. I don't understand why this doesn't happen with release1291. Be that as it may, we can't upgrade Phpunit to V10 because we need to support Php8.0. So, monkey around with tests/bootstrap.php to avoid problems.
This commit is contained in:
oleibman
2024-11-12 19:23:20 -08:00
parent 2aee18eb65
commit 4545ecf648
3 changed files with 37 additions and 17 deletions
+1
View File
@@ -97,6 +97,7 @@
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.6",
"squizlabs/php_codesniffer": "^3.7",
"symfony/process": "^5",
"tecnickcom/tcpdf": "^6.5"
},
"suggest": {
Generated
+16 -15
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "c7a7ba2e1cc9ac479e06ab28916c6b80",
"content-hash": "b26a18ad03352af543e5cf686162fdbb",
"packages": [
{
"name": "maennchen/zipstream-php",
@@ -4412,20 +4412,20 @@
},
{
"name": "symfony/polyfill-php80",
"version": "v1.29.0",
"version": "v1.31.0",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-php80.git",
"reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b"
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/87b68208d5c1188808dd7839ee1e6c8ec3b02f1b",
"reference": "87b68208d5c1188808dd7839ee1e6c8ec3b02f1b",
"url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"reference": "60328e362d4c2c802a54fcbf04f9d3fb892b4cf8",
"shasum": ""
},
"require": {
"php": ">=7.1"
"php": ">=7.2"
},
"type": "library",
"extra": {
@@ -4472,7 +4472,7 @@
"shim"
],
"support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.29.0"
"source": "https://github.com/symfony/polyfill-php80/tree/v1.31.0"
},
"funding": [
{
@@ -4488,7 +4488,7 @@
"type": "tidelift"
}
],
"time": "2024-01-29T20:11:03+00:00"
"time": "2024-09-09T11:45:10+00:00"
},
{
"name": "symfony/polyfill-php81",
@@ -4568,20 +4568,21 @@
},
{
"name": "symfony/process",
"version": "v6.0.19",
"version": "v5.4.46",
"source": {
"type": "git",
"url": "https://github.com/symfony/process.git",
"reference": "2114fd60f26a296cc403a7939ab91478475a33d4"
"reference": "01906871cb9b5e3cf872863b91aba4ec9767daf4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/2114fd60f26a296cc403a7939ab91478475a33d4",
"reference": "2114fd60f26a296cc403a7939ab91478475a33d4",
"url": "https://api.github.com/repos/symfony/process/zipball/01906871cb9b5e3cf872863b91aba4ec9767daf4",
"reference": "01906871cb9b5e3cf872863b91aba4ec9767daf4",
"shasum": ""
},
"require": {
"php": ">=8.0.2"
"php": ">=7.2.5",
"symfony/polyfill-php80": "^1.16"
},
"type": "library",
"autoload": {
@@ -4609,7 +4610,7 @@
"description": "Executes commands in sub-processes",
"homepage": "https://symfony.com",
"support": {
"source": "https://github.com/symfony/process/tree/v6.0.19"
"source": "https://github.com/symfony/process/tree/v5.4.46"
},
"funding": [
{
@@ -4625,7 +4626,7 @@
"type": "tidelift"
}
],
"time": "2023-01-01T08:36:10+00:00"
"time": "2024-11-06T09:18:28+00:00"
},
{
"name": "symfony/service-contracts",
+20 -2
View File
@@ -25,13 +25,31 @@ function phpunit10ErrorHandler(int $errno, string $errstr, string $filename, int
return true; // message suppressed - stop error handling
}
throw new Exception("$errstr $filename $lineno");
// This code applies only when running release210 with Php8.4.
// I don't get it at all. I think mitoteam is the victim of circumstance.
// We need to run PhpUnit 9 because we need to support Php8.0.
// We are at the highest release of PhpUnit9,
// but it refers to E_STRICT,
// which is deprecated in 8.4.
if (
str_contains($errstr, 'Constant ')
&& str_contains($errstr, ' already defined')
&& str_contains($filename, 'mitoteam')
) {
return true;
}
if (!method_exists(PHPUnit\Framework\TestCase::class, 'setOutputCallback')) {
throw new Exception("$errstr $filename $lineno");
}
throw new Exception("$errstr");
}
return false; // continue error handling
}
if (!method_exists(PHPUnit\Framework\TestCase::class, 'setOutputCallback')) {
if (!method_exists(PHPUnit\Framework\TestCase::class, 'setOutputCallback') || PHP_VERSION_ID >= 80400) {
ini_set('error_reporting', (string) E_ALL);
set_error_handler('phpunit10ErrorHandler');
}