I was testing the latest dev over at simplytest.me and I got this while typing in the search field in the add blocks form (/#overlay=admin/structure/block/list/block_plugin_ui%253Abartik/add):

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: /system/autocomplete/block_plugin_ui%3Abartik
StatusText: OK
ResponseText:
Fatal error: Class 'plugin.manager.block' not found in /home/hash/www/core/modules/system/system.module on line 1162

Funny thing, when I tried the same thing on a local dev I got no ResponseText/Fatal info and the error code was 500:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /system/autocomplete/block_plugin_ui%3Abartik
StatusText: Internal Server Error
ResponseText:
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

klonos’s picture

Issue summary: View changes

..

aaronott’s picture

I was able to confirm this on a local install. Using Firefox I got the following error:

An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: http://localhost/d8/system/autocomplete/block_plugin_ui%3Abartik
StatusText: OK
ResponseText: Fatal error: Class 'plugin.manager.block' not found in /usr/htdocs/d8/core/modules/system/system.module on line 1162
Call Stack:
0.0007     651840   1. {main}() /usr/htdocs/d8/index.php:0
0.0046    1516688   2. drupal_handle_request() /usr/htdocs/d8/index.php:17
0.1575   28486896   3. Symfony\Component\HttpKernel\Kernel->handle() /usr/htdocs/d8/core/includes/bootstrap.inc:2162
0.1597   28811128   4. Drupal\Core\HttpKernel->handle() /usr/htdocs/d8/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/Kernel.php:197
0.1597   28812784   5. Symfony\Component\HttpKernel\HttpKernel->handle() /usr/htdocs/d8/core/lib/Drupal/Core/HttpKernel.php:52
0.1597   28812784   6. Symfony\Component\HttpKernel\HttpKernel->handleRaw() /usr/htdocs/d8/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:73
0.2084   32607272   7. call_user_func_array() /usr/htdocs/d8/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:129
0.2084   32607640   8. Drupal\Core\EventSubscriber\{closure}() /usr/htdocs/d8/core/vendor/symfony/http-kernel/Symfony/Component/HttpKernel/HttpKernel.php:129
0.2084   32607720   9. call_user_func_array() /usr/htdocs/d8/core/lib/Drupal/Core/EventSubscriber/LegacyControllerSubscriber.php:46
0.2084   32608208  10. system_plugin_autocomplete() /usr/htdocs/d8/core/lib/Drupal/Core/EventSubscriber/LegacyControllerSubscriber.php:46

Steps to reproduce

  1. Install Drupal like normal
  2. Visit new site
  3. head to admin/structure/block
  4. Click Place Blocks
  5. Add text to search box on right
  6. Error will be displayed
vineet.osscube’s picture

Assigned: Unassigned » vineet.osscube
vineet.osscube’s picture

FileSize
863 bytes

Hi Team,

I've updated the "system.module" file to add "plugin.manager.block" data. Attaching patch for review ;)-

vineet.osscube’s picture

Status: Active » Needs review
FileSize
863 bytes

I've updated the "system.module" file to add "plugin.manager.block" data. Attaching patch for review .

yannickoo’s picture

Status: Needs review » Reviewed & tested by the community

Patch works fine!

yannickoo’s picture

Attached screenshot.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

Well we obviously need to add a test to ensure this is working... see https://drupal.org/simpletest

Also drupal_container() is deprecated... lets convert it to Drupal:: functions ... you can use Drupal::request() to get the request object and Drupal::service($name) to get services which don't have there own method.

So the autocomplete will look something like this...

function system_plugin_autocomplete($plugin_id) {
  $string_typed = Drupal::request()->query->get('q');
  $string_typed = drupal_explode_tags($string_typed);
  $string = drupal_strtolower(array_pop($string_typed));
  $matches = array();
  if ($string) {
    $plugin_ui = Drupal::service('plugin.manager.system.plugin_ui')->getDefinition($plugin_id);
    $manager = Drupal::service($plugin_ui['manager']);
    $titles = array();
    foreach($manager->getDefinitions() as $plugin_id => $plugin) {
      $titles[$plugin_id] = $plugin[$plugin_ui['title_attribute']];
    }
    $matches = preg_grep("/\b". $string . "/i", $titles);
  }

  return new JsonResponse($matches);
}
nick_schuch’s picture

vineet.osscube,

Im currently working on #1987826. I don't mind taking this one on also. Let me know if you are actively working on it.

nick_schuch

nick_schuch’s picture

Status: Needs work » Needs review
FileSize
1.57 KB
775 bytes

Here we go. One to prove the fail (via testing) and one to fix the issue.

larowlan’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quick fix

Lets get this in, it blocks #1987826: Convert system_plugin_autocomplete() to a new style controller
I think this qualifies for Quick Fix

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed 76f7b94 and pushed to 8.x. Thanks!

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

Anonymous’s picture

Issue summary: View changes

...