Problem/Motivation

Long error messages are appearing on a clean install of Drupal 9.0.8 and RestUI on the config page:

admin/config/services/rest

Steps to reproduce

  1. Start with a clean version of Drupal (9.0.8) installed with composer.
  2. Run "composer require drupal/restui"
  3. Enable module.
  4. Go to to main module config page and see this error message below.

If it's a configuration issue on my end, please let me know.

Thx.


    Notice: Undefined variable: enabled_methods in Drupal\restui\Controller\RestUIController->listResources() (line 196 of modules/contrib/restui/src/Controller/RestUIController.php).

    Drupal\restui\Controller\RestUIController->listResources()
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
    Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 705)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

    Warning: in_array() expects parameter 2 to be array, null given in Drupal\restui\Controller\RestUIController->listResources() (line 196 of modules/contrib/restui/src/Controller/RestUIController.php).

    Drupal\restui\Controller\RestUIController->listResources()
    call_user_func_array(Array, Array) (Line: 123)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 573)
    Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 124)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array) (Line: 97)
    Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}() (Line: 158)
    Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object, 1) (Line: 80)
    Symfony\Component\HttpKernel\HttpKernel->handle(Object, 1, 1) (Line: 57)
    Drupal\Core\StackMiddleware\Session->handle(Object, 1, 1) (Line: 47)
    Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object, 1, 1) (Line: 106)
    Drupal\page_cache\StackMiddleware\PageCache->pass(Object, 1, 1) (Line: 85)
    Drupal\page_cache\StackMiddleware\PageCache->handle(Object, 1, 1) (Line: 47)
    Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object, 1, 1) (Line: 52)
    Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object, 1, 1) (Line: 23)
    Stack\StackedHttpKernel->handle(Object, 1, 1) (Line: 705)
    Drupal\Core\DrupalKernel->handle(Object) (Line: 19)

etc

Issue fork restui-3185372

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

bogdog400 created an issue. See original summary.

bogdog400’s picture

Note: the error messages disappeared after I enabled one of the APIs.

clemens.tolboom’s picture

Status: Active » Needs review
StatusFileSize
new901 bytes
clemens.tolboom’s picture

Issue summary: View changes
K.A.T.’s picture

Status: Needs review » Reviewed & tested by the community

This patch worked for me! Also worked on D8.8.12.

cabita’s picture

This patch worked for me! Thanks a lot.

voleger’s picture

+1 for rtbc, patch works for me (drupal:9.1.0 on php:8.0)

psf_’s picture

+1 for rtbc, patch works for me (drupal:9.1.0 on php:7.4.13)

jnrfred’s picture

+1 patch works for me.

ilgnerfagundes’s picture

+1 patch works for me.

frocha’s picture

The patch #4 works for me!
Thank you @clemens.tolboom

rosk0’s picture

Thanks for the patch!
Works like a charm.

  • clemens.tolboom committed 3d4e9a6 on 8.x-1.x
    Issue #3185372 by clemens.tolboom, bogdog400: Undeclared variable error...
clemens.tolboom’s picture

Status: Reviewed & tested by the community » Fixed

For the record: I tried to use the issue fork @ d.o. ... when pushing I got

git push restui-3185372 restui-3185372/3185372-undeclared-variable-error 
Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
To git.drupal.org:issue/restui-3185372.git
 ! [remote rejected] restui-3185372/3185372-undeclared-variable-error -> restui-3185372/3185372-undeclared-variable-error (deny updating a hidden ref)
error: failed to push some refs to 'git.drupal.org:issue/restui-3185372.git'

Not sure why so jumped back to old school workflow.

Status: Fixed » Closed (fixed)

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