D 8.8.9

Notice: Undefined index: errors in Drupal\upgrade_status\DeprecationAnalyzer->analyze() (line 341 of /var/web/modules/contrib/upgrade_status/src/DeprecationAnalyzer.php)

#0 /var/web/core/includes/bootstrap.inc(600): _drupal_error_handler_real()
#1 /var/web/modules/contrib/upgrade_status/src/DeprecationAnalyzer.php(341): _drupal_error_handler()
#2 /var/web/modules/contrib/upgrade_status/src/Form/UpgradeStatusForm.php(915): Drupal\upgrade_status\DeprecationAnalyzer->analyze()
#3 /var/web/core/includes/batch.inc(295): Drupal\upgrade_status\Form\UpgradeStatusForm::parseProject()
#4 /var/web/core/includes/batch.inc(137): _batch_process()
#5 /var/web/core/includes/batch.inc(93): _batch_do()
#6 /var/web/core/modules/system/src/Controller/BatchController.php(55): _batch_page()
#7 [internal function]: Drupal\system\Controller\BatchController->batchPage()
#8 /var/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array()
#9 /var/web/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#10 /var/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext()
#11 /var/web/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext()
#12 /var/web/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#13 /var/web/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw()
#14 /var/web/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle()
#15 /var/web/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle()
#16 /var/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle()
#17 /var/web/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass()
#18 /var/web/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle()
#19 /var/web/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle()
#20 /var/web/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle()
#21 /var/web/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle()
#22 /var/web/index.php(19): Drupal\Core\DrupalKernel->handle()
#23 {main}

Comments

maxilein created an issue. See original summary.

maxilein’s picture

Issue summary: View changes
maxilein’s picture

It is preceded by a batch error from upgrade_status:

Message: PHPStan failed:

but that's it.

gábor hojtsy’s picture

Status: Active » Postponed (maintainer needs more info)

The phpstan failure message should be recorded in your log. If you have dblog module enabled you will find it there. Can you post that here? Also which project was being scanned while this error happened?

Normally Upgrade Status will try its best to wrap the phpstan parsing itself in a HTTP request sandbox, so if it fails, the batch does not fail at all. Your logs should also contain info as to what method was used. A message like Processing projects without HTTP sandboxing. @error where @error is an error message or another kind of "Processing projects..." log message from Upgrade Status.

Would need these pieces of info to move forward. Thanks!

maxilein’s picture

There is nothing else logged - I have even enabled backtracing for errors ...

gábor hojtsy’s picture

Are you using the latest version of the module? For me these messages preceed scanning any single project:

  • Processing projects with HTTP sandboxing. (but this could be different based on how it parses projects)
  • Processing [...]/web/modules/contrib/admin_toolbar (logs the project you are parsing)
  • THIS is where your actual parsing should happen.

The two above messages should help understand which project it was failing on and which mode of processing it chose based on your environment.

scrumorg’s picture

This same PHPStan error is happening for us too so I thought I'd post our logs in case it's helpful. I was scanning two contrib modules: config_filter and config_split.

It looks like there's two different errors. One says "Undefined variable: result" and the other is "Undefined index: errors"

Upgrade Status Version: 2.9
Config Filter Version: 1.5.0
Config Split Version: 1.0-beta1
Drupal Version: 8.9.1

Here's what I see in the logs...

---

Processing projects with HTTP sandboxing.

---

Processing /var/www/html/modules/contrib/config_filter.

---

Notice: Undefined variable: result in Drupal\upgrade_status\DeprecationAnalyzer->analyze() (line 276 of /var/www/html/modules/contrib/upgrade_status/src/DeprecationAnalyzer.php)

#0 /var/www/html/core/includes/bootstrap.inc(600): _drupal_error_handler_real(8, 'Undefined varia...', '/var/www/html/m...', 276, Array)
#1 /var/www/html/modules/contrib/upgrade_status/src/DeprecationAnalyzer.php(276): _drupal_error_handler(8, 'Undefined varia...', '/var/www/html/m...', 276, Array)
#2 /var/www/html/modules/contrib/upgrade_status/src/Controller/ScanResultController.php(144): Drupal\upgrade_status\DeprecationAnalyzer->analyze(Object(Drupal\Core\Extension\Extension))
#3 [internal function]: Drupal\upgrade_status\Controller\ScanResultController->analyze('module', 'config_filter')
#4 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#5 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#6 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#7 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#8 /var/www/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#9 /var/www/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#10 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#11 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /var/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#19 {main}

---

PHPStan failed:

---

Processing /var/www/html/modules/contrib/config_split.

---

Notice: Undefined variable: result in Drupal\upgrade_status\DeprecationAnalyzer->analyze() (line 276 of /var/www/html/modules/contrib/upgrade_status/src/DeprecationAnalyzer.php)

#0 /var/www/html/core/includes/bootstrap.inc(600): _drupal_error_handler_real(8, 'Undefined varia...', '/var/www/html/m...', 276, Array)
#1 /var/www/html/modules/contrib/upgrade_status/src/DeprecationAnalyzer.php(276): _drupal_error_handler(8, 'Undefined varia...', '/var/www/html/m...', 276, Array)
#2 /var/www/html/modules/contrib/upgrade_status/src/Controller/ScanResultController.php(144): Drupal\upgrade_status\DeprecationAnalyzer->analyze(Object(Drupal\Core\Extension\Extension))
#3 [internal function]: Drupal\upgrade_status\Controller\ScanResultController->analyze('module', 'config_split')
#4 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#5 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#6 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#7 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#8 /var/www/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#9 /var/www/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#10 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#11 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /var/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#19 {main}

---

PHPStan failed:

---

Notice: Undefined index: errors in Drupal\upgrade_status\DeprecationAnalyzer->analyze() (line 341 of /var/www/html/modules/contrib/upgrade_status/src/DeprecationAnalyzer.php)

#0 /var/www/html/core/includes/bootstrap.inc(600): _drupal_error_handler_real(8, 'Undefined index...', '/var/www/html/m...', 341, Array)
#1 /var/www/html/modules/contrib/upgrade_status/src/DeprecationAnalyzer.php(341): _drupal_error_handler(8, 'Undefined index...', '/var/www/html/m...', 341, Array)
#2 /var/www/html/modules/contrib/upgrade_status/src/Controller/ScanResultController.php(144): Drupal\upgrade_status\DeprecationAnalyzer->analyze(Object(Drupal\Core\Extension\Extension))
#3 [internal function]: Drupal\upgrade_status\Controller\ScanResultController->analyze('module', 'config_split')
#4 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#5 /var/www/html/core/lib/Drupal/Core/Render/Renderer.php(573): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#6 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(124): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#7 /var/www/html/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#8 /var/www/vendor/symfony/http-kernel/HttpKernel.php(151): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#9 /var/www/vendor/symfony/http-kernel/HttpKernel.php(68): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#10 /var/www/html/core/lib/Drupal/Core/StackMiddleware/Session.php(57): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#11 /var/www/html/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(47): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#12 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(106): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#13 /var/www/html/core/modules/page_cache/src/StackMiddleware/PageCache.php(85): Drupal\page_cache\StackMiddleware\PageCache->pass(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#14 /var/www/html/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(47): Drupal\page_cache\StackMiddleware\PageCache->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#15 /var/www/html/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(52): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 /var/www/vendor/stack/builder/src/Stack/StackedHttpKernel.php(23): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 /var/www/html/core/lib/Drupal/Core/DrupalKernel.php(708): Stack\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 /var/www/html/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#19 {main}

---

arno2mars’s picture

Hello,

I have exactly the same issue on my site.
For each scanned module, I have systematically 2 errors logged in dblog:

1- upgrade_status - PHPStan failed:
2- php - Notice: Undefined variable: result in Drupal\upgrade_status\DeprecationAnalyzer->analyze() (line 276 of \modules\contrib\upgrade_status\src\DeprecationAnalyzer.php)

And often, I also have this one (but not systematically):

3- upgrade_status - Notice: Undefined index: errors in Drupal\upgrade_status\DeprecationAnalyzer->analyze() (line 341 of \modules\contrib\upgrade_status\src\DeprecationAnalyzer.php)

I am using:

- laminas/laminas-servicemanager (3.4.1)
- laminas/laminas-text (2.7.1)
- mathieuviossat/arraytotexttable (v1.0.8)
- phpstan/phpstan (0.12.33)
- phpstan/phpstan-deprecation-rules (0.12.5)
- nette/utils (v3.1.2)
- nette/finder (v2.5.2)
- mglaman/phpstan-drupal (0.12.4)
- drupal/upgrade_status (2.9.0)

I have tried to uninstall and re-install the module with all above listed dependencies using composer (+ cache has been cleared). But after that the logs are still there.
To note that my vendor folder containing phpstan is one level up of my drupal root (don't know if it has any influence). All my scanned modules are in my root/modules/contrib folder (incl Upgrade status).

It seems that the scan result always detects missing core version requirement in *info.yml file + deprecated libraries, however it doesn't report any other deprecated functions for the 150 modules installed on my site. In the end, my scan results only have warnings but no errors. This looks surprisingly optimistic.

Does it mean that some deprecations may not be reported?

Thanks!

arno2mars’s picture

Hello,

Hallelujah!
After hours of researches, I have found what was the source of the PHPStan fail on my site, so I post here the solution that worked for me in case it helps the other users.
I have a drupal recommended-project installation, meaning that my vendor folder and composer json file are located at my project root, outside of my site root which is in a web folder. Like this:

- My-project-root
------ Vendor
------ Composer.json
------ web
---------- core
---------- modules
---------- sites
---------- ...

When updating drupal core via composer, it seems that the new core release comes with a composer json which gets inserted in the web folder. It seems that the presence of this composer json file disturbed the search of the vendor/bin/phpstan folder done in the DeprecationAnalyzer.php file.
After removing this composer json file in the web folder (keeping of course my project composer json at the root of my project) the issue disappeared and the module works now like a charm (all deprecations reported and no more errors in the log).

Hope this would help and save time to others.

Thanks again for the huge job done with this module!

Regards,

gábor hojtsy’s picture

Hm, we already have safeguards against that though?

https://git.drupalcode.org/project/upgrade_status/-/blob/8.x-2.x/src/Dep... bails out with an exception of phpstan was not found in the bin path it identified. That is then caught in https://git.drupalcode.org/project/upgrade_status/-/blob/8.x-2.x/src/For... and turned into a proper Drupal error message alongside disabling the ability to submit the form with any of the submit buttons.

Why is that not taking effect for you then?

siramsay’s picture

StatusFileSize
new883.13 KB

I am getting the same error, but notice is Notice: Undefined offset: 1
The rest of the dblog is identical as #7

Is this considered different?

Some notes/ observations

  1. It isn't for every module scanned. i.e. sometime a module can be scanned and no errors examples are Backup and Migrate 5.0.0-rc1 and Pathauto 8.x-1.8
  2. I am not getting PHPStan failed message

Modules with Errors / 4 out of 14 on the install I am testing

Chaos Tools 8.x-3.4 / ctools
Entity Print 8.x-2.2 / entity_print
Feeds 8.x-3.0-alpha9 / feeds
Twig Tweak 8.x-2.6 / twig_tweak

Attached it the inline error I get

Notice: Undefined offset: 1 in Drupal\upgrade_status\DeprecationAnalyzer->analyze() (line 293
Notice: Undefined offset: 1 in Drupal\upgrade_status\DeprecationAnalyzer->analyze() (line 290

System
Drupal 8.9.2
Apache/2.4.29 (Ubuntu)
PHP 7.3.18-1+ubuntu18.04.1+deb.sury.org+1

dbielke1986’s picture

StatusFileSize
new125.35 KB

I am getting the same error when trying to analyse the libraries-module.
The error

Notice: Undefined variable: result in Drupal\upgrade_status\DeprecationAnalyzer->analyze() (line 278 of /var/www/html/swportl/web/modules/contrib/upgrade_status/src/DeprecationAnalyzer.php)

cames from a bug within the "DeprecationAnalyzer.php".
If the $output is empty it is trying to output an $result which is never be filled before (see the attached image).

All the inputs to the

exec($this->binPath . '/phpstan analyse --error-format=json -c ' . $this->phpstanNeonPath . ' ' . $project_dir, $output);

seems to be fine for me. Probable an PhpStan error itself.

Arngrim’s picture

In my case the problem was the entity_update module, which defines drush_log and drush_print, because apparently drush gets loaded after the entity_update module.

I found out about this by logging the full phpStan exec path in DeprecationAnalyzer.php (around line 275) like this:

$phpStanCommand = $this->binPath . '/phpstan analyse --error-format=json -c ' . $this->phpstanNeonPath . ' ' . $project_dir;
\Drupal::logger('YOUR_MODULE')->notice($phpStanCommand);
exec($phpStanCommand, $output);

Pasting the $phpStanCommand into a shell, I got this:

PHP Fatal error: Cannot redeclare drush_log() (previously declared in C:\htdocs\wac\web\modules\contrib\entity_update\tests\modules\entity_update_tests\entity_update_tests.module:16) in C:\htdocs\wac\vendor\drush\drush\includes\drush.inc on line 68

So I commented out the redefinitions in the entity_update module and everything works as expected.

Perhaps something similar happens to the others here?

rohnjeynolds’s picture

StatusFileSize
new978 bytes

The condition described in #12 is what causes the AJAX errors I'm seeing, which include the one reported in the original issue, and which all have to do with $result and an 'errors' key inside that array being undefined. The attached patch initializes those variables and suppresses the errors for me, allowing scans to complete. Admittedly, in trying to make the module code more resilient against underlying PHPStan issues, this patch might be papering over a root cause.

gábor hojtsy’s picture

Version: 8.x-2.7 » 8.x-3.x-dev
Issue summary: View changes
Status: Postponed (maintainer needs more info) » Needs review
Issue tags: +Needs manual testing
StatusFileSize
new816 bytes

The 'errors' key is indeed not defined for the case when phpstan fails. It is also somewhat silent to the result side as we only log it but don't expose the fail in the results. We should. So I also changed the silent case to save the error as if it was a phpstan file error (tied to the info file in this case which is the only file we can be sure exists for an extension).

Fixing the $results key to be empty and then using it to log an empty error message is not helpful. The $results in the log was supposed to be $output. This is already fixed in the 3.x branch. Moving this issue there.

How does this look like? We cannot really test a phpstan fail condition in the test suite, so we'll need manual testing. (It should definitely fix the missing errors key, I have no doubt).

gábor hojtsy’s picture

StatusFileSize
new864 bytes

UpgradeStatusForm::parseProject() also has a similar failure fallback logic BTW. Taking more inspiration from there to use a fake file name as well to designate the error better. Also adding a human readable intro to the error log so people get a general idea of what is going on.

rohnjeynolds’s picture

StatusFileSize
new1.09 KB

The patch in #15 didn't apply to version 8.x-2.x for me, but when I applied manually and ran a scan, I still got errors because (a) the change from $result to $output on line 276 isn't in the patch, and (b) $output is an array but is treated as a string on line 280. The attached patch resolves those two issue and allows me to scan all projects in my site error-free.

gábor hojtsy’s picture

Title: Undefined index: errors in Drupal\upgrade_status\DeprecationAnalyzer->analyze() (line 341 » Log PHPStan error in project results to let people know it failed. Fix undefined errors index.
Status: Needs review » Reviewed & tested by the community
Issue tags: -Needs manual testing

Thanks for the manual testing!

  • Gábor Hojtsy committed 6214885 on 8.x-3.x
    Issue #3151995 by Gábor Hojtsy, rohnjeynolds, siramsay, JD_1, maxilein,...

  • Gábor Hojtsy committed 4018da8 on 8.x-3.x
    Issue #3151995 by Gábor Hojtsy, rohnjeynolds, siramsay, JD_1, maxilein,...

  • Gábor Hojtsy committed 099f4e5 on 8.x-2.x
    Issue #3151995 by Gábor Hojtsy, rohnjeynolds, siramsay, JD_1, maxilein,...
gábor hojtsy’s picture

Status: Reviewed & tested by the community » Fixed

Thanks all! This should resolve both the undefined 'errors' index and $results variable.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.