Skip to content

Error working with league/mime-type-detection #191

@artulloss

Description

@artulloss

The latest release of Strauss errors if the package or a dependent of league/mime-type-detection is installed

❯ composer install
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating autoload files
> @php bin/strauss.phar include-autoloader
[info] Modifying original autoload.php to add autoload_aliases.php in /Volumes/Code/strauss-error/vendor/
[info] Writing new autoload.php
[warning] No new autoload.php found: /Volumes/Code/strauss-error/vendor-prefixed/autoload.php
[info] Modifying original autoload.php to add `/Volumes/Code/strauss-error/vendor-prefixed/autoload.php
[info] Writing new autoload.php
1 package you are using is looking for funding.
Use the `composer fund` command to find out more!
> sh -c 'test -f ./bin/strauss.phar || curl -o bin/strauss.phar -L -C - https://github.com/BrianHenryIE/strauss/releases/latest/download/strauss.phar'
> @php bin/strauss.phar
[notice] Starting... 
[notice] Loading package...
[notice] Loading composer.json config...
[notice] Loading cli config...
[notice] Building dependency list...
[notice] Enumerating files...
[notice] Copying files...
[notice] Copying files
[notice] Determining changes...

Fatal error: Uncaught Error: Cannot access private constant League\MimeTypeDetection\FinfoMimeTypeDetector::INCONCLUSIVE_MIME_TYPES in phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/brianhenryie/simple-php-code-parser/src/Parsers/Helper/Utils.php:163
Stack trace:
#0 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/brianhenryie/simple-php-code-parser/src/Parsers/Helper/Utils.php(163): constant('\\League\\MimeTyp...')
#1 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/brianhenryie/simple-php-code-parser/src/Model/PHPParameter.php(98): BrianHenryIE\SimplePhpParser\Parsers\Helper\Utils::getPhpParserValueFromNode(Object(PhpParser\Node\Expr\ClassConstFetch), 'League\\MimeType...', Object(BrianHenryIE\SimplePhpParser\Parsers\Helper\ParserContainer))
#2 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/brianhenryie/simple-php-code-parser/src/Model/PHPMethod.php(121): BrianHenryIE\SimplePhpParser\Model\PHPParameter->readObjectFromPhpNode(Object(PhpParser\Node\Param), Object(PhpParser\Node\Stmt\ClassMethod), 'League\\MimeType...')
#3 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/brianhenryie/simple-php-code-parser/src/Model/PHPClass.php(101): BrianHenryIE\SimplePhpParser\Model\PHPMethod->readObjectFromPhpNode(Object(PhpParser\Node\Stmt\ClassMethod), 'League\\MimeType...')
#4 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/brianhenryie/simple-php-code-parser/src/Parsers/Visitors/ASTVisitor.php(123): BrianHenryIE\SimplePhpParser\Model\PHPClass->readObjectFromPhpNode(Object(PhpParser\Node\Stmt\Class_))
#5 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(196): BrianHenryIE\SimplePhpParser\Parsers\Visitors\ASTVisitor->enterNode(Object(PhpParser\Node\Stmt\Class_))
#6 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(98): PhpParser\NodeTraverser->traverseArray(Array)
#7 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(227): PhpParser\NodeTraverser->traverseNode(Object(PhpParser\Node\Stmt\Namespace_))
#8 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/nikic/php-parser/lib/PhpParser/NodeTraverser.php(76): PhpParser\NodeTraverser->traverseArray(Array)
#9 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/brianhenryie/simple-php-code-parser/src/Parsers/PhpCodeParser.php(233): PhpParser\NodeTraverser->traverse(Array)
#10 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/brianhenryie/simple-php-code-parser/src/Parsers/PhpCodeParser.php(114): BrianHenryIE\SimplePhpParser\Parsers\PhpCodeParser::process('<?php\nnamespace...', NULL, Object(BrianHenryIE\SimplePhpParser\Parsers\Helper\ParserContainer), Object(BrianHenryIE\SimplePhpParser\Parsers\Visitors\ASTVisitor))
#11 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/brianhenryie/simple-php-code-parser/src/Parsers/PhpCodeParser.php(49): BrianHenryIE\SimplePhpParser\Parsers\PhpCodeParser::getPhpFiles('<?php\nnamespace...', Array)
#12 phar:///Volumes/Code/strauss-error/bin/strauss.phar/src/Pipeline/FileSymbolScanner.php(154): BrianHenryIE\SimplePhpParser\Parsers\PhpCodeParser::getFromString('<?php\nnamespace...')
#13 phar:///Volumes/Code/strauss-error/bin/strauss.phar/src/Pipeline/FileSymbolScanner.php(130): BrianHenryIE\Strauss\Pipeline\FileSymbolScanner->find('<?php\nnamespace...', Object(BrianHenryIE\Strauss\Files\FileWithDependency))
#14 phar:///Volumes/Code/strauss-error/bin/strauss.phar/src/Console/Commands/DependenciesCommand.php(377): BrianHenryIE\Strauss\Pipeline\FileSymbolScanner->findInFiles(Object(BrianHenryIE\Strauss\Files\DiscoveredFiles))
#15 phar:///Volumes/Code/strauss-error/bin/strauss.phar/src/Console/Commands/DependenciesCommand.php(238): BrianHenryIE\Strauss\Console\Commands\DependenciesCommand->determineChanges()
#16 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/symfony/console/Command/Command.php(298): BrianHenryIE\Strauss\Console\Commands\DependenciesCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand(Object(BrianHenryIE\Strauss\Console\Commands\DependenciesCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 phar:///Volumes/Code/strauss-error/bin/strauss.phar/bin/strauss(34): Symfony\Component\Console\Application->run()
#21 phar:///Volumes/Code/strauss-error/bin/strauss.phar/bin/strauss(35): {closure}('0.22.3')
#22 /Volumes/Code/strauss-error/bin/strauss.phar(12): require('phar:///Volumes...')
#23 {main}
  thrown in phar:///Volumes/Code/strauss-error/bin/strauss.phar/vendor/brianhenryie/simple-php-code-parser/src/Parsers/Helper/Utils.php on line 163
Script @php bin/strauss.phar handling the prefix-namespaces event returned with error code 255
Script @prefix-namespaces was called via post-install-cmd

Please provide a minimal composer.json with the package that is affected and its precise version.

{
  "name": "adam/strauss-error",
  "description": "Minimal example for bug report",
  "type": "project",
  "license": "MIT",
  "autoload": {
    "psr-4": {
      "Adam\\StraussError\\": "src/"
    }
  },
  "authors": [
    {
      "name": "Adam Tulloss",
      "email": "artulloss@gmail.com"
    }
  ],
  "scripts": {
    "prefix-namespaces": [
      "sh -c 'test -f ./bin/strauss.phar || curl -o bin/strauss.phar -L -C - https://github.com/BrianHenryIE/strauss/releases/latest/download/strauss.phar'",
      "@php bin/strauss.phar",
      "@composer dump-autoload"
    ],
    "post-install-cmd": [
      "@prefix-namespaces"
    ],
    "post-update-cmd": [
      "@prefix-namespaces"
    ],
    "post-autoload-dump": [
      "@php bin/strauss.phar include-autoloader"
    ]
  },
  "require": {
    "league/mime-type-detection": "*"
  }
}

Please specify an affected file and state clearly the actual (problem) output and the expected output.

The fork of Simple-PHP-Code parser tries to access a private variable and errors.

https://github.com/BrianHenryIE/Simple-PHP-Code-Parser/blob/02fac9abfda04820a08a87c2a93c0cef718a1f48/src/Parsers/Helper/Utils.php#L163

https://github.com/thephpleague/mime-type-detection/blob/06fd1559cc50ad3300f5ce5c16ad9a53d52ba989/src/FinfoMimeTypeDetector.php#L14

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions