Closed (fixed)
Project:
Upgrade Status
Version:
8.x-3.3
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
29 Jan 2021 at 19:15 UTC
Updated:
23 Jun 2021 at 15:50 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
gábor hojtsyThanks for your input!
It is unfortunate that we are not getting a reason. The
$outputis expected to be the return value of phpstan. This is our related code snippet:So either phpstan output is entirely empty (which is not expected in case of success) or the exec() cannot execute for some reason. Do you have any reports in your watchdog / dblog / whatever log you are using? The same error should be logged there as per the snippet above, but if there was an exec error, that should appear too I think.
Comment #3
justcaldwellSorry, no clues in dblog, just the same error: PHPStan failed: Array ( ).
Maybe something is wonky in my environment — I'll be curious to see if anyone else reports the same.
Comment #4
oaswebI can tell that I do have the same. Seems to appear on any module, ranging from well maintained modules, via not so well maintained modules, to my small and simple module which isn't published.
Comment #5
ptmkenny commentedAlso having the same error since the upgrade to 3.3. Unable to find further clues in my logs.
Comment #6
gábor hojtsy@ptmkenny: did previous versions work? If so, feel free to downgrade (uninstall and install a previous version). Which version worked? That would help us debug the difference.
Comment #8
berramou commented@Gábor i have the same issue with 3.3 version after upgrading from 3.0.
I tested with older versions on (Drupal 8.9.13) here is the tests results:
PHPStan failed - PHP API deprecations cannot be checked. Reason: Array ( )Comment #9
ptmkenny commentedLike @berramou, I am on Drupal 8.9.13, and 3.3 gives the error; 3.1 (which I was using previously) works fine. I did not test 3.2.
Comment #10
gábor hojtsy@ptmkenny, @berramou: First of all, terribly sorry for such a fundamental a regression with 3.3. To see if this was a regression in our code and not a third party dependency, can you try downgrading to 3.1 but with up to date dependencies? That is, uninstall the current version and install 3.1 fresh. Thanks! There's only been 7 commits since 3.1, so we'll be able to figure this out :) I unfortunately cannot reproduce the problem locally though, so need your help.
Comment #11
berramou commentedHello @Gábor i just test it with fresh install:
.info.ymlfile:Results:


Comment #12
gábor hojtsy@berramou does a fresh install of 3.1 result in the same thing? I am trying to tell apart if the problem is caused by updates in upgrade_status or the dependencies that a fresh install/update inevitably pulls in.
Comment #13
berramou commentedYes fresh install with 3.1 version works fine.


It doesn’t show the error but still LOCAL SCAN RESULT wrong even if we have no problem still show there is 1 problem:
in the screen below show there is two problems in facebook comments but in reality there is only one:
I don't know if the other warning just hidden!
Comment #14
gábor hojtsy@berramou: well, I would not call that fine :D There is still that PHPStan error, but before #3195223: Multiple string offset errors and #3193835: Warning: Illegal string offset 'messages' in Drupal\upgrade_status\ScanResultFormatter->formatResult() the phpstan error was not formatter properly for display. It would still be counted but would not display properly. So 3.3 is a step forward then, since we are displaying the problem now. Your setup did not have a properly running PHPStan in 3.1 either but now it shows.
Comment #15
berramou commentedAh i see but i installed the module using composer and i checked the PHPStan is well installed with last version 0.12.70
and also i test the phpStan
Comment #16
gábor hojtsy@berramou: great, those errors should be showing up in the upgrade_status report too if phpstan execution was successful. We do generate a custom phpstan config file that contains helper for Drupal code processing, to find more of the problems though, so its not simply about running phpstan as-is you did. It could be that the config goes wrong or exec() itself is wrong, or PHP's process does not have permission to execute phpstan. This is how we create the custom config:
Can you help debug further if the config gets created in your temporary location, and what happens if you run phpstan with that config? This is how we run it where project path is the project to run against:
Comment #17
gábor hojtsyHere is a patch to help debug and possibly to commit later on :) Catches the error output in a separate file and displays that as well as the command that we ran, so you can manually reproduce it outside of upgrade_status if there is an error inside it.
Comment #18
berramou commentedAfter applying patch here is the error i get with 3.3 version
PHP API deprecations cannot be checked. Reason: Command was: ---------- /Users/USER/Devs/drupal-8.9/vendor/bin/phpstan analyse --error-format=json -c /tmp/upgrade_status/deprecation_testing.neon /Users/USER/Devs/drupal-8.9/modules/custom/d8_api 2> /tmp/upgrade_status/phpstan_error_output Command output: ---------- Command error: ---------- Failed loading /Applications/DevDesktop/php7_3_x64/ext/opcache.so: dlopen(/Applications/DevDesktop/php7_3_x64/ext/opcache.so, 0x0009): code signature in (/Applications/DevDesktop/php7_3_x64/ext/opcache.so) not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed. Failed loading /Applications/DevDesktop/php7_3_x64/ext/xdebug.so: dlopen(/Applications/DevDesktop/php7_3_x64/ext/xdebug.so, 0x0009): code signature in (/Applications/DevDesktop/php7_3_x64/ext/xdebug.so) not valid for use in process: mapped file has no cdhash, completely unsigned? Code has to be at least ad-hoc signed. PHP Warning: Class 'PHPUnit\Framework\AssertionFailedError' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 192 Warning: Class 'PHPUnit\Framework\AssertionFailedError' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 192 PHP Warning: Class 'PHPUnit\Framework\Constraint\Count' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 193 Warning: Class 'PHPUnit\Framework\Constraint\Count' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 193 PHP Warning: Class 'PHPUnit\Framework\Error\Error' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 194 Warning: Class 'PHPUnit\Framework\Error\Error' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 194 PHP Warning: Class 'PHPUnit\Framework\Error\Warning' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 195 Warning: Class 'PHPUnit\Framework\Error\Warning' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 195 PHP Warning: Class 'PHPUnit\Framework\ExpectationFailedException' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 196 Warning: Class 'PHPUnit\Framework\ExpectationFailedException' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 196 PHP Warning: Class 'PHPUnit\Framework\Exception' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 197 Warning: Class 'PHPUnit\Framework\Exception' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 197 PHP Warning: Class 'PHPUnit\Framework\MockObject\Matcher\InvokedRecorder' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 198 Warning: Class 'PHPUnit\Framework\MockObject\Matcher\InvokedRecorder' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 198 PHP Warning: Class 'PHPUnit\Framework\SkippedTestError' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 199 Warning: Class 'PHPUnit\Framework\SkippedTestError' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 199 PHP Warning: Class 'PHPUnit\Framework\TestCase' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 200 Warning: Class 'PHPUnit\Framework\TestCase' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 200 PHP Warning: Class 'PHPUnit\Util\Test' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 201 Warning: Class 'PHPUnit\Util\Test' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 201 PHP Warning: Class 'PHPUnit\Util\Xml' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 202 Warning: Class 'PHPUnit\Util\Xml' not found in /Users/USER/Devs/drupal-8.9/core/tests/bootstrap.php on line 202 Error thrown in /Users/USER/Devs/drupal-8.9/core/tests/Drupal/TestTools/PhpUnitCompatibility/RunnerVersion.php on line 27 while loading bootstrap file /Users/USER/Devs/drupal-8.9/vendor/mglaman/phpstan-drupal/drupal-autoloader.php: Class 'PHPUnit\Runner\Version' not foundI use Acquia DevDesktop version 2
Comment #19
gábor hojtsy@berramou: Looks like it is an error with xdebug and opcache extensions. https://community.komodoide.com/t/xdebug-code-signature-in-not-valid/4422 is a similar problem with xdebug.
Comment #20
berramou commentedYes i did googled the error and i found that the issue with Xdebug and Opcache extensions on Mac environments.
So after all it's not Upgrade Status Module issue.
Thank you @Gábor for your time and your contributions.
I will keep looking if i find any workaround i will post it here.
Comment #21
gábor hojtsyRe Dev Desktop, unfortunately I received this link: https://docs.acquia.com/dev-desktop/migrate-to-ide/ Notably this on the top of the page:
So you may find a local solution to it for now, but the problem will not be fixed in Acquia Dev Desktop unfortunately.
Comment #22
gábor hojtsy@ptmkenny are you having the same experience with the patch above? Are you also using Dev Desktop or some other environment?
Comment #23
oaswebI tried your patch in my dev-environment which is on Win10 with Xampp. (Guess there might be som comments on that, however, for my small project it works well enough.) As far as I know it is quite standard setup, given the platform.
In any case here is the output I got when scanning "Display Suite" which is otherwise D9-ready and reported as such.
PHP API deprecations cannot be checked. Reason: Command was: ---------- C:\xampp\htdocs/vendor/bin/phpstan analyse --error-format=json -c C:\xampp\tmp/upgrade_status/deprecation_testing.neon C:\xampp\htdocs\public_html/modules/contrib/ds 2> C:\xampp\tmp/upgrade_status/phpstan_error_output Command output: ---------- Command error: ---------- PHP Warning: Class 'PHPUnit\Framework\AssertionFailedError' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 192 Warning: Class 'PHPUnit\Framework\AssertionFailedError' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 192 PHP Warning: Class 'PHPUnit\Framework\Constraint\Count' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 193 Warning: Class 'PHPUnit\Framework\Constraint\Count' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 193 PHP Warning: Class 'PHPUnit\Framework\Error\Error' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 194 Warning: Class 'PHPUnit\Framework\Error\Error' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 194 PHP Warning: Class 'PHPUnit\Framework\Error\Warning' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 195 Warning: Class 'PHPUnit\Framework\Error\Warning' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 195 PHP Warning: Class 'PHPUnit\Framework\ExpectationFailedException' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 196 Warning: Class 'PHPUnit\Framework\ExpectationFailedException' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 196 PHP Warning: Class 'PHPUnit\Framework\Exception' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 197 Warning: Class 'PHPUnit\Framework\Exception' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 197 PHP Warning: Class 'PHPUnit\Framework\MockObject\Matcher\InvokedRecorder' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 198 Warning: Class 'PHPUnit\Framework\MockObject\Matcher\InvokedRecorder' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 198 PHP Warning: Class 'PHPUnit\Framework\SkippedTestError' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 199 Warning: Class 'PHPUnit\Framework\SkippedTestError' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 199 PHP Warning: Class 'PHPUnit\Framework\TestCase' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 200 Warning: Class 'PHPUnit\Framework\TestCase' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 200 PHP Warning: Class 'PHPUnit\Util\Test' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 201 Warning: Class 'PHPUnit\Util\Test' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 201 PHP Warning: Class 'PHPUnit\Util\Xml' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 202 Warning: Class 'PHPUnit\Util\Xml' not found in C:\xampp\htdocs\public_html\core\tests\bootstrap.php on line 202 Error thrown in C:\xampp\htdocs\public_html\core\tests\Drupal\TestTools\PhpUnitCompatibility\RunnerVersion.php on line 27 while loading bootstrap file C:\xampp\htdocs\vendor\mglaman\phpstan-drupal\drupal-autoloader.php: Class 'PHPUnit\Runner\Version' not foundIf I run it on my private and tiny module to remove N/A from a radio-button, I get a very similar output. Could post that as well if you think it provides some info. (It's more natural to run a scan on that one for people as it is listed in the section where the user are asked to perform a scan...
Comment #24
gábor hojtsy@oasweb: XAMMP on Windows 10 should be fine, no problem with that IMHO. https://www.drupal.org/blog/drupal-8-will-no-longer-include-dev-dependen... details how to install dev dependencies, so those phpunit classes will be present. In short, you'll need to run
composer install --dev. This is explained on the project page for Upgrade Status too:If you already did that, we need to figure out why is that not found.
Comment #25
oaswebThank you for your response. I was quite sure that I had used the - - dev option when I installed it. But it has been some back and forth lately, so I will verify that I picked the right composer set, and have a look in the evening.
Comment #26
gábor hojtsySlightly improved the formatting of the error, so that at least on the Upgrade Status UI it looks more readable. The logged string has the tags escaped and newlines are not effective either, so I avoided them going into the log. That is less readable, but still present. Retitled for what is happening in this issue now.
Comment #27
gábor hojtsyNote that I also opened #3196065: Detect if Drupal developer dependencies were not installed properly for the possibly common scenario of missing developer dependencies. Posted an idea patch there but that does not yet work. Help welcome :D
Comment #28
gábor hojtsyAlso deal with the case of the error output being empty for the sake of consistency and clean reporting. Abstracted error filename so it is easier to follow.
Comment #29
oaswebWell, now I went one step further back in my composer set and ensured to follow the steps
And then applied the patch.
This is what I regard as the important part reported by composer during install:
However, the results are the same as far as I can see, unless nicer formatted...
Anyhow, I think it is a good idea to pinpoint the --dev-part, as well as to remind if not enabled.
I looked into my require-dev-section of the composer.json, the only part in there is drush. Is that relevant?
Comment #30
gábor hojtsy@oasweb: hm, core require-dev has a lot of stuff https://git.drupalcode.org/project/drupal/-/blob/9.2.x/composer.json -- is that not in the default Drupal project composer setup or do you have a custom setup?
Comment #31
eduardo morales albertiI think it is is an error related with phpstan
I tried (composer 2)
composer require phpstan/phpstan:0.12.26 mglaman/drupal-check:1.1.3 -W --devAnd now works right.
Also here is an issue on drupal-check project https://github.com/mglaman/drupal-check/issues/202
Comment #32
gábor hojtsy@Eduardo: well, "PHPUnit\Framework\TestCase not found " is not exactly the same problem as "PHPUnit\Framework\TestCase is not an interface". Looks like there are multiple problems.
Comment #34
gábor hojtsyI committed the patch and will release a new version, so people can get clear error reports. Not going to close this, since not all actual resulting errors were resolved yet, but they appear to be outside of the scope of the code of upgrade status for now, so moving to support request. Thanks all for testing the patch to help future users debug.
Comment #35
gábor hojtsyReleased https://www.drupal.org/project/upgrade_status/releases/8.x-3.4 with the above fix.
Comment #36
alexdoma commentedjust test last version on windows
PHPStan command failed:
/vendor/bin/phpstan analyse --error-format=json -c /tmp/upgrade_status/deprecation_testing.neon
/modules/custom/block_ajax 2> /tmp/upgrade_status/phpstan_error_output
Command output:
Empty.
Command error:
Warning: Class 'PHPUnit\Framework\AssertionFailedError' not found in \core\tests\bootstrap.php on line 192 Warning: Class 'PHPUnit\Framework\Constraint\Count' not found in \core\tests\bootstrap.php on line 193 Warning: Class 'PHPUnit\Framework\Error\Error' not found in \core\tests\bootstrap.php on line 194 Warning: Class 'PHPUnit\Framework\Error\Warning' not found in \core\tests\bootstrap.php on line 195 Warning: Class 'PHPUnit\Framework\ExpectationFailedException' not found in \core\tests\bootstrap.php on line 196 Warning: Class 'PHPUnit\Framework\Exception' not found in \core\tests\bootstrap.php on line 197 Warning: Class 'PHPUnit\Framework\MockObject\Matcher\InvokedRecorder' not found in \core\tests\bootstrap.php on line 198 Warning: Class 'PHPUnit\Framework\SkippedTestError' not found in \core\tests\bootstrap.php on line 199 Warning: Class 'PHPUnit\Framework\TestCase' not found in \core\tests\bootstrap.php on line 200 Warning: Class 'PHPUnit\Util\Test' not found in \core\tests\bootstrap.php on line 201 Warning: Class 'PHPUnit\Util\Xml' not found in \core\tests\bootstrap.php on line 202 Error thrown in \core\tests\Drupal\TestTools\PhpUnitCompatibility\RunnerVersion.php on line 27 while loading bootstrap file \vendor\mglaman\phpstan-drupal\drupal-autoloader.php: Class 'PHPUnit\Runner\Version' not found
Comment #37
gábor hojtsy@alexdoma: do you have phpunit installed? See #24 above.
Comment #38
alexdoma commented@gábor-hojtsy
I have run composer install --dev
Should i install phpunit in different way? or it depends on composer version?
Comment #39
oaswebThank you @Gábor! Your #30 helped me out. I thought I was on a standard setup, however my "require-dev" was for sure not. After what I now think is more standard, this
PHPStan failed 0 PHP API deprecations cannot be checked. Reason: Array ( ), has disappeared completely. I do have some of those "PHPUnit\Framework\TestCase not found", but agree that those are a different case.Could it be that this whole issue appeared due to that some of us doesn't have all their dependencies fully in place? (And for some reason isn't aware of it) And then the error is thrown? If so, then I would guess the best mitigation is either to throw an error, with a suggested list of things to verify "Have you verified your require-dev-dependencies? As a minimum xxx should be present". Or even better, if possible, to require whats needed during install. Being quite a newbie with composer and Drupal I am not fully aware of whats possible/feasible or best practise. Anyhow some people will be helped out by this thread I would guess.
The best thing, the upgrade_status-module has now helped me to be ready to move over to Drupal 9, thank you! :)
Comment #40
azinck commented@Alexdoma: perhaps you're in my situation. I installed drupal using just drupal/core-recommended and didn't bring in drupal/core-dev. You'll need to do something like:
composer require --dev drupal/core-dev:[constraint for your version of drupal]More info here: https://www.drupal.org/docs/develop/using-composer/starting-a-site-using...
Comment #41
chamilsanjeewa commented@Gábor Hojtsy #30
This is not working( not a correct way to handle the situation). In My case, I am in drupal 8.9 and I need to catch the deprecated functions and issues in my module before I move to Drupal 9.x.
So its is not possible to run upgrade the site into D9 and run the upgrade status.
This is my configurations -
Drupal version : 8.9.13
"phpstan/phpstan": "^0.12.8",
"drupal/upgrade_status": "^3.4"
Really appreciate your comments about this.
Comment #42
gábor hojtsy@chamilsanjeewa: sounds like you have a standalone question? That site should be able to run Upgrade Status. Please post in a new support request.
Comment #43
rjensen26 commentedI ran into the same issue... this is what I did to resolve my problem.
1.
composer require phpunit/phpunit:^6.5 --no-update2.
composer require drupal/core-dev:^8.9 --no-update3.
composer updateHope this helps
Comment #44
gábor hojtsy@rjensen26: we don't suggest adding phpunit directly to your project as a non-dev dependency that would end up in the deployed project likely. That said, if you don't (accidentally) commit this to your live project, it could be fine locally.
Comment #45
rjensen26 commented@Gábor Hojtsy, I wouldn't commit that to the project, thanks though
Comment #46
gábor hojtsyThere is the first issue with underlying problems reported at #3200187: Web UI fails with /usr/bin/env: php: No such file or directory. I think at this point it would be better if people with underlying issues exposed thanks to the above open separate issues so we can discuss them there rather than intertwined here. There were different underlying problems reported here, which we expose now, but discussing them intermixed is hard.
Comment #48
darkodev commentedFWIW, noting @Gábor Hojtsy warning to @ rjensen26 about adding phpunit independent of dev dependencies, the following cleared up my PHPstan issues:
composer require drupal/core-dev:^8.9 --no-update
composer update
Comment #49
kgeeraerts commentedI can confirm that #48 also fixed the problem for me!