summaryrefslogtreecommitdiffstats
path: root/phpunit-php8.patch
blob: 8143a3afb2d027a5a5d22f46d2c9c2dd4c36033e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
diff -up ./PHPUnit/Framework/TestCase.php.php8 ./PHPUnit/Framework/TestCase.php
--- ./PHPUnit/Framework/TestCase.php.php8	2021-03-19 12:29:00.122960437 +0100
+++ ./PHPUnit/Framework/TestCase.php	2021-03-19 12:29:16.926880988 +0100
@@ -1059,7 +1059,7 @@ abstract class PHPUnit_Framework_TestCas
         $this->registerMockObjectsFromTestArguments($testArguments);
 
         try {
-            $testResult = $method->invokeArgs($this, $testArguments);
+            $testResult = $method->invokeArgs($this, array_values($testArguments));
         } catch (Throwable $_e) {
             $e = $_e;
         } catch (Exception $_e) {
diff -up ./PHPUnit/Util/Configuration.php.php8 ./PHPUnit/Util/Configuration.php
--- ./PHPUnit/Util/Configuration.php.php8	2018-02-01 06:50:59.000000000 +0100
+++ ./PHPUnit/Util/Configuration.php	2021-03-19 12:28:10.627194461 +0100
@@ -159,7 +159,7 @@ class PHPUnit_Util_Configuration
         $this->xpath    = new DOMXPath($this->document);
     }
 
-    final private function __clone()
+    private function __clone()
     {
     }
 
diff -up ./tests/_files/Singleton.php.php8 ./tests/_files/Singleton.php
--- ./tests/_files/Singleton.php.php8	2018-02-01 06:50:59.000000000 +0100
+++ ./tests/_files/Singleton.php	2021-03-19 12:28:10.627194461 +0100
@@ -7,7 +7,7 @@ class Singleton
     {
     }
 
-    final private function __clone()
+    private function __clone()
     {
     }
 
diff -up ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php.php8 ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php
--- ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php.php8	2018-02-01 06:50:59.000000000 +0100
+++ ./tests/Framework/Constraint/JsonMatches/ErrorMessageProviderTest.php	2021-03-19 12:28:10.627194461 +0100
@@ -39,7 +39,7 @@ class Framework_Constraint_JsonMatches_E
     {
         return [
             'JSON_ERROR_NONE'  => [
-                null, 'json_error_none', ''
+                null, JSON_ERROR_NONE, ''
             ],
             'JSON_ERROR_DEPTH' => [
                 'Maximum stack depth exceeded', JSON_ERROR_DEPTH, ''
diff -up ./tests/Framework/ConstraintTest.php.php8 ./tests/Framework/ConstraintTest.php
--- ./tests/Framework/ConstraintTest.php.php8	2018-02-01 06:50:59.000000000 +0100
+++ ./tests/Framework/ConstraintTest.php	2021-03-19 12:28:10.627194461 +0100
@@ -1233,7 +1233,7 @@ EOF
 
         $this->assertTrue($constraint->evaluate($resource, '', true));
 
-        @fclose($resource);
+        if (is_resource($resource)) @fclose($resource);
     }
 
     public function testConstraintIsNotType()
@@ -2547,7 +2547,6 @@ EOF
         // Default case.
         $constraint = new PHPUnit_Framework_Constraint_TraversableContains('foo');
 
-        $this->assertTrue($constraint->evaluate([0], '', true));
         $this->assertTrue($constraint->evaluate([true], '', true));
     }
 
diff -up ./PHPUnit/Util/Configuration.php.old ./PHPUnit/Util/Configuration.php
--- ./PHPUnit/Util/Configuration.php.old	2021-09-10 07:36:55.786834316 +0200
+++ ./PHPUnit/Util/Configuration.php	2021-09-10 07:38:02.485723035 +0200
@@ -501,21 +501,23 @@ class PHPUnit_Util_Configuration
             // See https://github.com/sebastianbergmann/phpunit/issues/277
             switch ($array) {
                 case 'var':
-                    $target = &$GLOBALS;
+                    foreach ($configuration[$array] as $name => $value) {
+                        $GLOBALS[$name] = $value;
+                    }
                     break;
 
                 case 'server':
-                    $target = &$_SERVER;
+                    foreach ($configuration[$array] as $name => $value) {
+                        $_SERVER[$name] = $value;
+                    }
                     break;
 
                 default:
-                    $target = &$GLOBALS['_' . strtoupper($array)];
+                    foreach ($configuration[$array] as $name => $value) {
+                        $GLOBALS['_' . strtoupper($array)][$name] = $value;
+                    }
                     break;
             }
-
-            foreach ($configuration[$array] as $name => $value) {
-                $target[$name] = $value;
-            }
         }
 
         foreach ($configuration['env'] as $name => $value) {
diff -up ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist.old ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist
--- ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist.old	2021-09-10 07:43:43.165206553 +0200
+++ ./PHPUnit/Util/PHP/Template/TestCaseMethod.tpl.dist	2021-09-10 07:43:46.619201163 +0200
@@ -81,7 +81,7 @@ if ('' !== $configurationFilePath) {
     unset($configuration);
 }
 
-function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext)
+function __phpunit_error_handler($errno, $errstr, $errfile, $errline, $errcontext=null)
 {
    return true;
 }
diff -up ./PHPUnit/Framework/Constraint/IsType.php.old ./PHPUnit/Framework/Constraint/IsType.php
--- ./PHPUnit/Framework/Constraint/IsType.php.old	2021-11-23 07:39:40.865503163 +0100
+++ ./PHPUnit/Framework/Constraint/IsType.php	2021-11-23 07:39:58.420422741 +0100
@@ -116,7 +116,20 @@ class PHPUnit_Framework_Constraint_IsTyp
                 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);