Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE ] Add possibility to retrieve low-level Phar internals #10

Merged
merged 15 commits into from
Jan 19, 2019

Conversation

ohader
Copy link
Member

@ohader ohader commented Jan 19, 2019

Resolves: #9

Basic functionality

Usage of Reader

$reader = new \TYPO3\PharStreamWrapper\Phar\Reader('storage/bundle.phar');
$container = $reader->resolveContainer();
// retrieves alias name, either from Stub (experimental) or from Manifest
$alias = $container->getAlias();
// retrieves meta-data array, fails in case it contains (malicious?) serialized objects
$metaDataArray = $container->getManifest()->deserializeMetaData();
// output
var_dump($container);

Possible output for $container

class TYPO3\PharStreamWrapper\Phar\Container#7 (2) {
  private $stub =>
  class TYPO3\PharStreamWrapper\Phar\Stub#8 (2) {
    private $content =>
    string(5) "<?php"
    private $mappedAlias =>
    string(0) ""
  }
  private $manifest =>
  class TYPO3\PharStreamWrapper\Phar\Manifest#9 (8) {
    private $manifestLength =>
    int(224)
    private $amountOfFiles =>
    int(3)
    private $apiVersion =>
    string(5) "1.1.0"
    private $flags =>
    int(65536)
    private $aliasLength =>
    int(9)
    private $alias =>
    string(9) "bndl.phar"
    private $metaDataLength =>
    int(35)
    private $metaData =>
    string(35) "a:1:{s:6:"vendor";s:9:"TYPO3Demo";}"
  }
}

@ohader ohader merged commit 88f5a96 into master Jan 19, 2019
alexpott pushed a commit to alexpott/phar-stream-wrapper that referenced this pull request Jan 25, 2019
[FEATURE ] Add possibility to retrieve low-level Phar internals

(cherry picked from commit 88f5a96)
@ohader ohader deleted the feature/phar-reader branch February 12, 2019 21:02
@ohader ohader mentioned this pull request Feb 27, 2019
4 tasks
@ohader ohader added this to the Phar Alias handling milestone Feb 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add possibility to retrieve low-level Phar internals
1 participant