sebastianbergmann / phploc

A tool for quickly measuring the size of a PHP project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

I found this error : Undefined index: ccn

webmailcontatos opened this issue · comments

Version : phploc 3.0.0 by Sebastian Bergmann
Complete message : PHP Notice: Undefined index: ccn in phar:///usr/local/bin/phploc/src/Analyser.php on line 507

Code who generate this error :

Possible dublicate of #141?

Is same problem but the code is different, maybe could be more a test

The problem seems to be related to the use in the closure declaration.

any ETA on the fix, as i'm not 100% sure what happens in the analyzer (it seems to be quite complex)

It is too complex, I'm afraid, and should be rewritten from scratch.

@sebastianbergmann would there be anything wrong with just initializing the ccn index? See my diff below, works for me.

https://github.com/timhoeppner/phploc/commit/e544f60f6663c222945ff3bd3c239351daa76ca6

@timhoeppner That would just hide the problem.

We're suffering from this, too; and, well, I'm no mathematician, but it looks already wrong by looking at it: on line 507, the index ccn is increased without any check wether it's present; and looking above there is nothing which intrinsically will initialize it... So why not actually init it like @timhoeppner said?

Or should the ccn index be there as of the algorithm and it's actually an error if it's not?

Good question @afoeder . I have the same feeling

Sorry, but I have to repeat myself: that would just hide this problem and create another.

The problem here is that entire analyser should be rewritten. From scratch. Using either PHP-Parser (maybe with BetterReflection in front of it) or using PHP 7's internal AST. Trying to reason about PHP code just by looking at tokens is insane.

Duplicate of #141.