From 8dc28e30cb14ba9c19845b858b7ab7b6d79d8088 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 23 Nov 2021 07:54:28 +0100 Subject: additional fix for PHP 8 --- phpunit7-php8.patch | 25 +++++++++++++++++++++++++ phpunit7.spec | 6 ++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/phpunit7-php8.patch b/phpunit7-php8.patch index c5c9e06..998785f 100644 --- a/phpunit7-php8.patch +++ b/phpunit7-php8.patch @@ -317,3 +317,28 @@ diff -up ./src/Util/PHP/Template/TestCaseMethod.tpl.dist.old ./src/Util/PHP/Temp { return true; } +diff -up ./src/Framework/Constraint/IsType.php.old ./src/Framework/Constraint/IsType.php +--- ./src/Framework/Constraint/IsType.php.old 2021-11-23 07:43:17.366683633 +0100 ++++ ./src/Framework/Constraint/IsType.php 2021-11-23 07:43:35.332633310 +0100 +@@ -137,7 +137,20 @@ class IsType extends Constraint + return \is_object($other); + + case 'resource': +- return \is_resource($other) || \is_string(@\get_resource_type($other)); ++ if (is_resource($other)) { ++ return true; ++ } ++ ++ try { ++ $resource = @get_resource_type($other); ++ ++ if (is_string($resource)) { ++ return true; ++ } ++ } catch (\TypeError $e) { ++ } ++ ++ return false; + + case 'scalar': + return \is_scalar($other); diff --git a/phpunit7.spec b/phpunit7.spec index 0ca8082..38db195 100644 --- a/phpunit7.spec +++ b/phpunit7.spec @@ -28,7 +28,7 @@ Name: %{pk_project}%{ver_major} Version: %{ver_major}.%{ver_minor}.%{ver_patch} -Release: 7%{?dist} +Release: 8%{?dist} Summary: The PHP Unit Testing framework version %{ver_major} License: BSD @@ -269,7 +269,6 @@ for cmd in php php73 php74 php80 php81; do FILTER="testStaticAttributesBackupPre" fi if [ $VER -ge 80000 ]; then - FILTER="$FILTER|testResourceTypeCanBeAsserted|testNotResourceTypeCanBeAsserted" FILTER="$FILTER|testCountTraversable|testConstraintTraversableCheckForObjectIdentityForDefaultCase" OPT="$OPT --filter '^((?!($FILTER)).)*$'" fi @@ -293,6 +292,9 @@ exit $ret %changelog +* Tue Nov 23 2021 Remi Collet - 7.5.20-8 +- additional fix for PHP 8 + * Fri Sep 10 2021 Remi Collet - 7.5.20-7 - add minimal patch for PHP 8.1 -- cgit