Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitab45e2a

Browse files
committed
[VarDumper] Fix caster for invalid SplFileInfo objects on php 8.
1 parent63eab44 commitab45e2a

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

‎src/Symfony/Component/VarDumper/Caster/SplCaster.php‎

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

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

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

101115
foreach ($mapas$key =>$accessor) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp