Giter Club home page Giter Club logo

Comments (5)

otruffer avatar otruffer commented on May 24, 2024

I now have a workaround. But it hits in the nikic/php-parser library.

Index: vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
--- vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php    (revision )
+++ vendor/nikic/php-parser/lib/PhpParser/ParserAbstract.php    (revision )
@@ -140,10 +140,15 @@
                     $symbol = $tokenId >= 0 && $tokenId < $this->tokenToSymbolMapSize
                         ? $this->tokenToSymbol[$tokenId]
                         : $this->invalidSymbol;
                    if ($symbol === $this->invalidSymbol) {
+
+                        //In hhvm (script)files that start with unix annotations like "#!/usr/bin/env php" crashes the lexer and this part. This is a workaround.
+                        if(substr($tokenValue, 0, 2) == "#!") {
+                            continue;
+                        }
+
                         throw new \RangeException(sprintf(
                            'The lexer returned an invalid token (id=%d, value=%s)',
                             $tokenId, $tokenValue
                         ));
                     }

from phpdependencyanalysis.

mamuz avatar mamuz commented on May 24, 2024

Hi,

sorry for late answer..a lot of todos on my side ;)
I think its a good approach to ask Nikita Popov (owner of https://github.com/nikic/PHP-Parser) directly for this issue.

BTW: Unix annotations like "#!..." are called shebang (http://en.wikipedia.org/wiki/Shebang_(Unix))

Hopefully i will find time to investigate it, too.

from phpdependencyanalysis.

mamuz avatar mamuz commented on May 24, 2024

Php-Parser added hashbang support nikic/PHP-Parser@592836c

Waiting for release, after that everything should be fine.

from phpdependencyanalysis.

mamuz avatar mamuz commented on May 24, 2024

Hi @otruffer,

latest Release v0.4.1 includes dependency update to phpParser to 1.2.*

Shebang issue under hhvm should be fixed now.

from phpdependencyanalysis.

otruffer avatar otruffer commented on May 24, 2024

Hi

Thanks a lot for your work!

Cheers
Oskar

from phpdependencyanalysis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.