From ab45e2aaae2e612d4fb8646edde028fd754b4f2b Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Sat, 5 Sep 2020 19:37:15 +0200 Subject: [PATCH] [VarDumper] Fix caster for invalid SplFileInfo objects on php 8. --- .../Component/VarDumper/Caster/SplCaster.php | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/VarDumper/Caster/SplCaster.php b/src/Symfony/Component/VarDumper/Caster/SplCaster.php index 53df3de2392e3..7ecbb577d2d01 100644 --- a/src/Symfony/Component/VarDumper/Caster/SplCaster.php +++ b/src/Symfony/Component/VarDumper/Caster/SplCaster.php @@ -92,10 +92,24 @@ public static function castFileInfo(\SplFileInfo $c, array $a, Stub $stub, $isNe unset($a["\0SplFileInfo\0fileName"]); unset($a["\0SplFileInfo\0pathName"]); - if (false === $c->getPathname()) { - $a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state'; + if (\PHP_VERSION_ID < 80000) { + if (false === $c->getPathname()) { + $a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state'; - return $a; + return $a; + } + } else { + try { + $c->isReadable(); + } catch (\RuntimeException $e) { + if ('Object not initialized' !== $e->getMessage()) { + throw $e; + } + + $a[$prefix.'⚠'] = 'The parent constructor was not called: the object is in an invalid state'; + + return $a; + } } foreach ($map as $key => $accessor) { pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy