From 50d9f617c10050a0206f4374dea7f2e0920333cc Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Wed, 14 Jul 2021 08:59:06 +0200 Subject: [PATCH] Support debugging of File and FileReference It already was supported, but tried to output the contents. We explicitly deny the `getContents()` method. Relates: #2 --- Classes/Utility/DebuggerUtility.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Classes/Utility/DebuggerUtility.php b/Classes/Utility/DebuggerUtility.php index d863acd..d930bc9 100644 --- a/Classes/Utility/DebuggerUtility.php +++ b/Classes/Utility/DebuggerUtility.php @@ -643,11 +643,19 @@ class DebuggerUtility protected static function exposeMethod(ReflectionMethod $method): bool { $methodName = $method->getName(); + $className = $method->getDeclaringClass()->getName(); $allowedPrefixes = ['get', 'has', 'is']; + $notAllowedCombinations = [ + 'TYPO3\CMS\Core\Resource\FileReference::getContents', + 'TYPO3\CMS\Core\Resource\File::getContents', + ]; $allowedByName = false; foreach ($allowedPrefixes as $allowedPrefix) { - if (StringUtility::beginsWith($methodName, $allowedPrefix)) { + if ( + StringUtility::beginsWith($methodName, $allowedPrefix) + && in_array($className . '::' . $methodName, $notAllowedCombinations) === false + ) { $allowedByName = true; break; }