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
Cannot create new nodes, when internal state is frozen. #328
Comments
Hi @radmen , thanks for the issue, but it's a bit too vague. |
@ravage84 Unfortunatelly I cannot share the source code on which phpmd was failing. I'll try to create repo with failing PHPMD build. |
I totally understand that. Try what you can, we appreciate it. |
@ravage84 I've managed to extract the failing parts from my project. Here you can find repo: https://github.com/radmen/phpmd-nodes-freeze-error This code can be run under docker:
|
I'm getting the same error. Is there a temporary work-around that I could use? |
I too am getting this error with a PHP 7.0RC7 project using PHPMD master. I'll narrow the code down and post something reproducible later today. |
If it helps, I'm also getting the identical error (PHP7.0.0-dev Oct 22: the Ubuntu based "rasmus" dev Vagrant VM: running on a Windows 7 host with the project source files mounted from Windows) - but only on one of the two projects (one, a library project, with 3848 LOC, but it works okay on a Slim3 project which only has 399 LOC). |
I narrowed it down (at least in my case) to this example code. If PHPMD encounters a return type declaration it chokes on the next method. If I put that method last it works. Can anyone confirm these code snippets produce the same results for you? Errors <?php
class Foo
{
function bar() : \stdClass
{
}
function baz()
{
}
} Success <?php
class Foo
{
function baz()
{
}
function bar() : \stdClass
{
}
} Note: not sure if this http://news.php.net/php.internals/89375 will effect this issue or not. Just wanted to give a heads up in case it does. |
Yeah that's what causing it in my case too, @quantumpacket |
@ravage84 is there a time-frame on when this may be fixed? It essentially breaks PHPMD in PHP7 applications using return type declarations so no other PHPMD warnings are triggered, and also as a side effect is piling up errors for every single modification to a file in PhpStorm. I'm easily getting 300+ errors over the course of editing a file and the only way to fix it is to comment out any return type declarations. |
Bump. Experiencing this issue as well with PHP7 using return type declarations. I've had to completely disable PHPMD for my current project. |
+1 |
I've manged to solve the issue but it is a problem in pdepend. pdepend/pdepend@master...marco-msg-ferrari:master I need help creating the regression test to submit the PR. |
+1 |
An update to this (as I've hit the same issue and wasn't sure how far it had gotten) seems to be that @marco-msg-ferrari submitted a pull request to pdepend which appears to have been merged into master. Looking at the tags, it appears this will be added to pdepend 2.3, though I can't see an approx date for stable release. |
Just to also confirm I get the same error using PHP 7.0.3-4+deb.sury.org~trusty+1. Disabling phpmd for now. |
+1 |
Same error on php 7.0.3 |
Even though that PR is merged, still getting this error. Installed with:
|
I resolve this error temporarily by this, that may not work for you, but for me is enough while waiting a real solution, you must not use php7 namespace grouped declaration. $filename = 'vendor/pdepend/pdepend/src/main/php/PDepend/Source/Language/PHP/PHPBuilder.php';
$str = file_get_contents($filename);
//I comment this line :)
$newStr = str_replace('$this->frozen = true;', '//$this->frozen = true;', $str);
file_put_contents($filename, $newStr); I run this once in my local env and at each build |
We also experienced the same thing in CircleCI, locally all seems fine.
|
+1 |
An issue with PHP 7 return types has caused an invalid state within PDepend's Parser and AST.
This is a bit tricky issue.
For start I know that this error is actually triggered by
pdepend/pdepend
package yet it happens when I'm using PHPMD so I decided to post this issue here.I'm trying to run PHPMD on my PHP7 project. In most cases it fails with message:
I've tried to run PHPMD for some directories located inside my
src
dir and it worked. Yet again, when I tried to put them together separated by comma the fail message returned.I'm not sure what's causing this problem. At first I've thought it's a problem of code written in PHP7 yet it seems to be unrelated (for single directories PHPMD works).
I'm using PHPMD in
2.3.2
version.Tried to run binary in PHP
5.6.15
, and7.0RC7
The text was updated successfully, but these errors were encountered: