Support debugging of File and FileReference

It already was supported, but tried to output the contents.
We explicitly deny the `getContents()` method.

Relates: #2
This commit is contained in:
Daniel Siepmann 2021-07-14 08:59:06 +02:00
parent 92c28ef25b
commit 50d9f617c1
Signed by: Daniel Siepmann
GPG key ID: 33D6629915560EF4

View file

@ -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;
}