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

I found this error : Undefined index: ccn #142

Closed
webmailcontatos opened this issue Feb 3, 2016 · 11 comments
Closed

I found this error : Undefined index: ccn #142

webmailcontatos opened this issue Feb 3, 2016 · 11 comments

Comments

@webmailcontatos
Copy link

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 :

@Eternal-Infinity
Copy link

Possible dublicate of #141?

@webmailcontatos
Copy link
Author

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

@sebastianbergmann
Copy link
Owner

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

@KasperFranz
Copy link

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

@sebastianbergmann
Copy link
Owner

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

@timhoeppner
Copy link

@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

@sebastianbergmann
Copy link
Owner

@timhoeppner That would just hide the problem.

@afoeder
Copy link

afoeder commented Mar 18, 2016

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?

@webmailcontatos
Copy link
Author

Good question @afoeder . I have the same feeling

@sebastianbergmann
Copy link
Owner

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.

@sebastianbergmann
Copy link
Owner

Duplicate of #141.

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

6 participants