Skip to content

Commit df324a0

Browse files
Merge branch '4.4' into 5.1
* 4.4: [Debug] fix test consistently use same types for strict comparisons [PhpUnitBridge] Skip internal classes in CoverageListenerTrait [VarExporter] unserialize() might throw an Exception on php 8. [ErrorHandler] Parse "x not found" errors correctly on php 8. Prevent parsing invalid octal digits as octal numbers remove unnecessary check for existing request [DI] fix ContainerBuilder on PHP8 [Console] Make sure $maxAttempts is an int or null. [VarDumper] Fix caster for invalid SplFileInfo objects on php 8. [Intl] Skip test cases that produce a TypeError on php 8. [PhpUnitBridge] Adjust output parsing for PHPUnit 9.3. [PhpUnitBridge] CoverageListenerTrait update for PHPUnit 8.5/9.x add bosnian (bs) translation [Debug] Parse "x not found" errors correctly on php 8.
2 parents d8c2398 + 3406f88 commit df324a0

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

Caster/SplCaster.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,10 +94,24 @@ public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, bool
9494
unset($a["\0SplFileInfo\0fileName"]);
9595
unset($a["\0SplFileInfo\0pathName"]);
9696

97-
if (false === $c->getPathname()) {
98-
$a[$prefix.''] = 'The parent constructor was not called: the object is in an invalid state';
97+
if (\PHP_VERSION_ID < 80000) {
98+
if (false === $c->getPathname()) {
99+
$a[$prefix.''] = 'The parent constructor was not called: the object is in an invalid state';
99100

100-
return $a;
101+
return $a;
102+
}
103+
} else {
104+
try {
105+
$c->isReadable();
106+
} catch (\RuntimeException $e) {
107+
if ('Object not initialized' !== $e->getMessage()) {
108+
throw $e;
109+
}
110+
111+
$a[$prefix.''] = 'The parent constructor was not called: the object is in an invalid state';
112+
113+
return $a;
114+
}
101115
}
102116

103117
foreach ($map as $key => $accessor) {

0 commit comments

Comments
 (0)