File tree 2 files changed +9
-12
lines changed
2 files changed +9
-12
lines changed Original file line number Diff line number Diff line change 16
16
use function array_intersect_key ;
17
17
use function array_map ;
18
18
use function count ;
19
- use function explode ;
20
- use function file_get_contents ;
19
+ use function file ;
21
20
use function in_array ;
22
- use function is_file ;
23
21
use function preg_replace ;
24
22
use function range ;
25
23
use function str_ends_with ;
@@ -269,13 +267,11 @@ private function getEmptyLinesForFile(string $filename): array
269
267
if (!isset (self ::$ emptyLineCache [$ filename ])) {
270
268
self ::$ emptyLineCache [$ filename ] = [];
271
269
272
- if (is_file ($ filename )) {
273
- $ sourceLines = explode ("\n" , file_get_contents ($ filename ));
270
+ $ sourceLines = @file ($ filename ) ?: [];
274
271
275
- foreach ($ sourceLines as $ line => $ source ) {
276
- if (trim ($ source ) === '' ) {
277
- self ::$ emptyLineCache [$ filename ][] = ($ line + 1 );
278
- }
272
+ foreach ($ sourceLines as $ line => $ source ) {
273
+ if (trim ($ source ) === '' ) {
274
+ self ::$ emptyLineCache [$ filename ][] = ($ line + 1 );
279
275
}
280
276
}
281
277
}
Original file line number Diff line number Diff line change 13
13
use function file_get_contents ;
14
14
use function file_put_contents ;
15
15
use function implode ;
16
- use function is_file ;
17
16
use function md5 ;
18
17
use function serialize ;
19
18
use function unserialize ;
@@ -169,12 +168,14 @@ private function read(string $filename): array|false
169
168
{
170
169
$ cacheFile = $ this ->cacheFile ($ filename );
171
170
172
- if (!is_file ($ cacheFile )) {
171
+ $ contents = @file_get_contents ($ cacheFile );
172
+
173
+ if ($ contents === false ) {
173
174
return false ;
174
175
}
175
176
176
177
return unserialize (
177
- file_get_contents ( $ cacheFile ) ,
178
+ $ contents ,
178
179
[
179
180
'allowed_classes ' => [
180
181
Class_::class,
You can’t perform that action at this time.
4 commit comments
sebastianbergmann commentedon Dec 20, 2024
@staabm Not entirely sure, but I suspect this change broke something: https://github.com/sebastianbergmann/phpunit/actions/runs/12426606434/job/34695291633
staabm commentedon Dec 20, 2024
I think you are right that the problem is triggered from this code here.
the root cause seems to be some error handler which turns warnings into exceptions
(and does not respect the
@
operator)sebastianbergmann commentedon Dec 20, 2024
This should be the relevant code from PHPUnit's error handler:
https://github.com/sebastianbergmann/phpunit/blob/9c95792570a40b05991f3842c3005d848c8b1fc9/src/Runner/ErrorHandler.php#L82-L88
staabm commentedon Dec 20, 2024
ahh.. the stacktrace of your first link makes the problem obvious. working on a fix