tophitter / php-sql-parser

Automatically exported from code.google.com/p/php-sql-parser
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Typo, undefined constants #111

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
At ShowProcessor.php:143, 
    $resultList[] = array('expr_type' => expr_type, 'name' => $token,   
should be:
    $resultList[] = array('expr_type' => $expr_type, 'name' => $token,   

You can find errors like these using the HipHop-based static analysis tool 
(with some false positives): https://github.com/sebastianbergmann/hhvm-wrapper

Here's my output from running it on the latest download if it's helpful 
(20131130):

/home/gygilab/gschneeloch/PHP-SQL-Parser/classes/processors/column-def-processor
.php
  330   Constant ExpressionType::COMMENT is not declared
  337   Constant ExpressionType::DEF_VALUE is not declared

/home/gygilab/gschneeloch/PHP-SQL-Parser/classes/oracle-sql-translator.php
  240   Constant ASTERISK_ALIAS is not declared
  259   Constant ASTERISK_ALIAS is not declared
  276   Call to unknown method: $this->stop('SELECT', $k, $v, 'expr_type')
  301   Constant ASTERISK_ALIAS is not declared

/home/gygilab/gschneeloch/PHP-SQL-Parser/classes/processors/show-processor.php
  145   Constant expr_type is not declared

/home/gygilab/gschneeloch/PHP-SQL-Parser/classes/processors/create-def-processor
.php
  366   Too many arguments in function or method call:
        $processor->process(array_slice($tokens, $k, null, true), $expr)

Original issue reported on code.google.com by noisecap...@gmail.com on 3 Jan 2014 at 9:36

GoogleCodeExporter commented 8 years ago
Nice tool, thank you for the info. I'll check the code. The 
oracle-sql-translator is an example only, it doesn't work with the current 
codebase.

Original comment by pho...@gmx.de on 6 Jan 2014 at 8:39

GoogleCodeExporter commented 8 years ago
I need a 64bit system to install HHVM and then the wrapper. At the moment I use 
an outdated 64 bit Fedora 14, where I have problems with the gcc version. Can 
anyone run the analysis tool against the latest /trunk version and post the 
results here? Thanks a lot.

Original comment by pho...@gmx.de on 8 Jan 2014 at 10:50

GoogleCodeExporter commented 8 years ago
Here it is (hphpa is a slightly older version of hhvm-wrapper)

hphpa 1.3.0 by Sebastian Bergmann.

Using ruleset /usr/share/php/data/hphpa/ruleset.xml

/home/gygilab/gschneeloch/php-sql-parser-read-only/src/builders/LikeBuilder.php
  63    Variable $like is not declared

/home/gygilab/gschneeloch/php-sql-parser-read-only/src/processors/ColumnDefiniti
onProcessor.php
  350   Constant ExpressionType::COMMENT is not declared

/home/gygilab/gschneeloch/php-sql-parser-read-only/src/builders/DeleteStatementB
uilder.php
  72    Call to unknown method: $this->processFROM($parsed['FROM'])
  74    Call to unknown method: $this->processWHERE($parsed['WHERE'])

/home/gygilab/gschneeloch/php-sql-parser-read-only/src/PHPSQLCreator.php
  74    Bad call to constructor: new SelectStatementBuilder($parsed)
  78    Bad call to constructor: new InsertStatementBuilder($parsed)
  82    Bad call to constructor: new DeleteStatementBuilder($parsed)
  86    Bad call to constructor: new UpdateStatementBuilder($parsed)
  93    Bad call to constructor: new ShowStatementBuilder($parsed)
  97    Bad call to constructor: new CreateStatementBuilder($parsed)

/home/gygilab/gschneeloch/php-sql-parser-read-only/src/builders/InsertStatementB
uilder.php
  61    Bad call to constructor: new InsertBuilder($parsed)

/home/gygilab/gschneeloch/php-sql-parser-read-only/src/processors/CreateDefiniti
onProcessor.php
  375   Too many arguments in function or method call:
        $processor->process(array_slice($tokens, $k, null, true), $expr)

Found 12 violations in 6 files (out of 119 total files).

Original comment by noisecap...@gmail.com on 8 Jan 2014 at 3:48

GoogleCodeExporter commented 8 years ago
Thank you, I'll fix that this evening.

Original comment by pho...@gmx.de on 8 Jan 2014 at 5:19

GoogleCodeExporter commented 8 years ago
Fixed in r944.

Original comment by pho...@gmx.de on 8 Jan 2014 at 8:08

GoogleCodeExporter commented 8 years ago
I have installed hphpa, but if I execute 

hphpa --checkstyle ./php-sql-parser.xml /localhome/arothe/php/PHP-SQL-Parser/src

I'll get 

HipHop failed to complete static analysis.

Is there any logfile to investigate the problem?
Thanks!

Original comment by pho...@gmx.de on 9 Jan 2014 at 12:45

GoogleCodeExporter commented 8 years ago
What happens if you just run hhvm from the command line? Are there any useful 
error messages there? Most of the problems I've had were to do with hhvm being 
installed incorrectly in some way.

Original comment by noisecap...@gmail.com on 9 Jan 2014 at 2:53

GoogleCodeExporter commented 8 years ago
I should add that I've found hhvm is pretty difficult to install due to 
reliance on lots of bleeding edge versions of libraries. The Facebook github 
wiki has good build instructions for the most popular distros but it might be 
easier to just download a Ubuntu VM using vagrant and installing hhvm using 
apt-get there

Original comment by noisecap...@gmail.com on 9 Jan 2014 at 3:01

GoogleCodeExporter commented 8 years ago
Hm, I have found in the hphpa source code, that I need an installed hhvm. But 
that is the main problem, it needs a 64 bit system. I'll try to use an Ubuntu 
VM on my outdated system :-)

Original comment by pho...@gmx.de on 10 Jan 2014 at 8:10