function PharMetaDataInterceptor::baseFileDoesNotHaveMetaDataIssues

Parameters

string $path:

Return value

bool

1 call to PharMetaDataInterceptor::baseFileDoesNotHaveMetaDataIssues()
PharMetaDataInterceptor::assert in misc/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php
Determines whether the according Phar archive contains (potential insecure) serialized objects.

File

misc/typo3/phar-stream-wrapper/src/Interceptor/PharMetaDataInterceptor.php, line 53

Class

PharMetaDataInterceptor
@internal Experimental implementation of checking against serialized objects in Phar meta-data @internal This functionality has not been 100% pentested...

Namespace

TYPO3\PharStreamWrapper\Interceptor

Code

private function baseFileDoesNotHaveMetaDataIssues($path) {
    $invocation = Manager::instance()->resolve($path);
    if ($invocation === null) {
        return false;
    }
    // directly return in case invocation was checked before
    if ($invocation->getVariable(__CLASS__) === true) {
        return true;
    }
    // otherwise analyze meta-data
    try {
        $reader = new Reader($invocation->getBaseName());
        $reader->resolveContainer()
            ->getManifest()
            ->deserializeMetaData();
        $invocation->setVariable(__CLASS__, true);
    } catch (DeserializationException $exception) {
        return false;
    }
    return true;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.