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

Syntax error, unexpected T_STRING #54

Open
soullivaneuh opened this issue Feb 23, 2018 · 5 comments
Open

Syntax error, unexpected T_STRING #54

soullivaneuh opened this issue Feb 23, 2018 · 5 comments

Comments

@soullivaneuh
Copy link

$ composer-require-checker -vv


Warning: preg_match(): Compilation failed: nothing to repeat at offset 1 in phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php on line 29

Warning: preg_match(): Compilation failed: nothing to repeat at offset 1 in phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php on line 29

Warning: preg_match(): Compilation failed: nothing to repeat at offset 1 in phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php on line 29

Warning: preg_match(): Compilation failed: nothing to repeat at offset 1 in phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php on line 29

Warning: preg_match(): Compilation failed: nothing to repeat at offset 1 in phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php on line 29

Warning: preg_match(): Compilation failed: nothing to repeat at offset 1 in phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php on line 29

# And many more Warning like that.

In ParserAbstract.php line 293:
                                               
  [PhpParser\Error]                            
  Syntax error, unexpected T_STRING on line 1  
                                               

Exception trace:
 PhpParser\ParserAbstract->parse() at phar:///usr/bin/composer-require-checker/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php:50
 PhpParser\Parser\Multiple->tryParse() at phar:///usr/bin/composer-require-checker/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php:31
 PhpParser\Parser\Multiple->parse() at phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/ASTLocator/LocateASTFromFiles.php:35
 ComposerRequireChecker\ASTLocator\LocateASTFromFiles->__invoke() at phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/DefinedSymbolsLocator/LocateDefinedSymbolsFromASTRoots.php:27
 ComposerRequireChecker\DefinedSymbolsLocator\LocateDefinedSymbolsFromASTRoots->__invoke() at phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/Cli/CheckCommand.php:73
 ComposerRequireChecker\Cli\CheckCommand->execute() at phar:///usr/bin/composer-require-checker/vendor/symfony/console/Command/Command.php:252
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:865
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:241
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:143
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer-require-checker/bin/composer-require-checker.php:32
 include() at /usr/bin/composer-require-checker:10

check [--config-file CONFIG-FILE] [--ignore-parse-errors] [--] [<composer-json>]

Using --ignore-parse-errors works but keep the lot of warning messages.

It would be great to see which files causes this error.

@Ocramius
Copy link
Collaborator

Can you try running with -vvv?

@soullivaneuh
Copy link
Author

Of course, but you have nothing more:

$ ./docker-console composer-require-checker -vvv
ComposerRequireChecker 0.2.0

In ParserAbstract.php line 293:
                                               
  [PhpParser\Error]                            
  Syntax error, unexpected T_STRING on line 1  
                                               

Exception trace:
 PhpParser\ParserAbstract->parse() at phar:///usr/bin/composer-require-checker/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php:50
 PhpParser\Parser\Multiple->tryParse() at phar:///usr/bin/composer-require-checker/vendor/nikic/php-parser/lib/PhpParser/Parser/Multiple.php:31
 PhpParser\Parser\Multiple->parse() at phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/ASTLocator/LocateASTFromFiles.php:35
 ComposerRequireChecker\ASTLocator\LocateASTFromFiles->__invoke() at phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/DefinedSymbolsLocator/LocateDefinedSymbolsFromASTRoots.php:27
 ComposerRequireChecker\DefinedSymbolsLocator\LocateDefinedSymbolsFromASTRoots->__invoke() at phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/Cli/CheckCommand.php:73
 ComposerRequireChecker\Cli\CheckCommand->execute() at phar:///usr/bin/composer-require-checker/vendor/symfony/console/Command/Command.php:252
 Symfony\Component\Console\Command\Command->run() at phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:865
 Symfony\Component\Console\Application->doRunCommand() at phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:241
 Symfony\Component\Console\Application->doRun() at phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:143
 Symfony\Component\Console\Application->run() at phar:///usr/bin/composer-require-checker/bin/composer-require-checker.php:32
 include() at /usr/bin/composer-require-checker:10

check [--config-file CONFIG-FILE] [--ignore-parse-errors] [--] [<composer-json>]

@maglnet
Copy link
Owner

maglnet commented Feb 24, 2018

Regarding the warnings:
This seems to be related to a * within an exclude-from-classmap key, that makes the regex invalid, but I currently do not understand why this fails, because I think we're using the same logic like the composer classmap generator.
Could you please check if composer dump-autoload -o gives these warnings, too?

The Syntax error could also be caused by a short open tag, you could try running the phar file with:

php -d short_open_tag=1 composer-require-checker.phar

and see if this fixes the problem.

If this does not help, could you please add your composer.lock file, so I could see if I find any hints what could cause the problems?

@soullivaneuh
Copy link
Author

Here is the result of the dump-autoload:

$ composer dump-autoload -o
Generating optimized autoload files
Warning: Ambiguous class resolution, "Symfony\Component\Dotenv\Dotenv" was found in both "/code/vendor/symfony/dotenv/Dotenv.php" and "/code/vendor/symfony/symfony/src/Symfony/Component/Dotenv/Dotenv.php", the first will be used.
Warning: Ambiguous class resolution, "Symfony\Component\Dotenv\Exception\ExceptionInterface" was found in both "/code/vendor/symfony/dotenv/Exception/ExceptionInterface.php" and "/code/vendor/symfony/symfony/src/Symfony/Component/Dotenv/Exception/ExceptionInterface.php", the first will be used.
Warning: Ambiguous class resolution, "Symfony\Component\Dotenv\Exception\PathException" was found in both "/code/vendor/symfony/dotenv/Exception/PathException.php" and "/code/vendor/symfony/symfony/src/Symfony/Component/Dotenv/Exception/PathException.php", the first will be used.
Warning: Ambiguous class resolution, "Symfony\Component\Dotenv\Exception\FormatExceptionContext" was found in both "/code/vendor/symfony/dotenv/Exception/FormatExceptionContext.php" and "/code/vendor/symfony/symfony/src/Symfony/Component/Dotenv/Exception/FormatExceptionContext.php", the first will be used.
Warning: Ambiguous class resolution, "Symfony\Component\Dotenv\Exception\FormatException" was found in both "/code/vendor/symfony/dotenv/Exception/FormatException.php" and "/code/vendor/symfony/symfony/src/Symfony/Component/Dotenv/Exception/FormatException.php", the first will be used.

Concerning the short_open_tag:

$ php -d xdebug.max_nesting_level=5000 -d short_open_tag=1 $(which composer-require-checker)

...
Warning: preg_match(): Compilation failed: nothing to repeat at offset 1 in phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php on line 29

Call Stack:
    0.0005     415496   1. {main}() /usr/bin/composer-require-checker:0
    0.0022     611416   2. include('phar:///usr/bin/composer-require-checker/bin/composer-require-checker.php') /usr/bin/composer-require-checker:10
    0.0123    1479832   3. ComposerRequireChecker\Cli\Application->run() phar:///usr/bin/composer-require-checker/bin/composer-require-checker.php:32
    0.0188    1729008   4. ComposerRequireChecker\Cli\Application->doRun() phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:143
    0.0191    1731800   5. ComposerRequireChecker\Cli\Application->doRunCommand() phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:241
    0.0191    1731800   6. ComposerRequireChecker\Cli\CheckCommand->run() phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:865
    0.0193    1733528   7. ComposerRequireChecker\Cli\CheckCommand->execute() phar:///usr/bin/composer-require-checker/vendor/symfony/console/Command/Command.php:252
    0.0349    4055200   8. ComposerRequireChecker\DefinedSymbolsLocator\LocateDefinedSymbolsFromASTRoots->__invoke() phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/Cli/CheckCommand.php:73
   47.6826    8866816   9. ComposerRequireChecker\ASTLocator\LocateASTFromFiles->__invoke() phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/DefinedSymbolsLocator/LocateDefinedSymbolsFromASTRoots.php:27
   47.6826    8866816  10. ComposerRequireChecker\FileLocator\LocateAllFilesByExtension->filterFilesByExtension() phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/ASTLocator/LocateASTFromFiles.php:34
   47.6837    8867032  11. preg_match() phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php:29


Warning: preg_match(): Compilation failed: nothing to repeat at offset 1 in phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php on line 29

Call Stack:
    0.0005     415496   1. {main}() /usr/bin/composer-require-checker:0
    0.0022     611416   2. include('phar:///usr/bin/composer-require-checker/bin/composer-require-checker.php') /usr/bin/composer-require-checker:10
    0.0123    1479832   3. ComposerRequireChecker\Cli\Application->run() phar:///usr/bin/composer-require-checker/bin/composer-require-checker.php:32
    0.0188    1729008   4. ComposerRequireChecker\Cli\Application->doRun() phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:143
    0.0191    1731800   5. ComposerRequireChecker\Cli\Application->doRunCommand() phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:241
    0.0191    1731800   6. ComposerRequireChecker\Cli\CheckCommand->run() phar:///usr/bin/composer-require-checker/vendor/symfony/console/Application.php:865
    0.0193    1733528   7. ComposerRequireChecker\Cli\CheckCommand->execute() phar:///usr/bin/composer-require-checker/vendor/symfony/console/Command/Command.php:252
    0.0349    4055200   8. ComposerRequireChecker\DefinedSymbolsLocator\LocateDefinedSymbolsFromASTRoots->__invoke() phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/Cli/CheckCommand.php:73
   47.6826    8866816   9. ComposerRequireChecker\ASTLocator\LocateASTFromFiles->__invoke() phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/DefinedSymbolsLocator/LocateDefinedSymbolsFromASTRoots.php:27
   47.6826    8866816  10. ComposerRequireChecker\FileLocator\LocateAllFilesByExtension->filterFilesByExtension() phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/ASTLocator/LocateASTFromFiles.php:34
   47.6837    8867032  11. preg_match() phar:///usr/bin/composer-require-checker/src/ComposerRequireChecker/FileLocator/LocateAllFilesByExtension.php:29


In ParserAbstract.php line 293:
                                               
  Syntax error, unexpected T_STRING on line 1  
                                               

check [--config-file CONFIG-FILE] [--ignore-parse-errors] [--] [<composer-json>]

@maglnet
Copy link
Owner

maglnet commented Mar 20, 2018

The Warning: preg_match(): Compilation failed... should be fixed with 0.2.1 now. / #60

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

No branches or pull requests

3 participants