Two Drupal 8 Core Bugs: Found and Fixed

Two Drupal 8 Core Bugs: Found and Fixed

FFW Blog - illustration
default avatar
Thought byJesus Olivas
Drupal 8 Solution Architect
October 30, 2014

While working on the console project I have found (so far) two Drupal 8 core bugs. In this blog post I will explain how I found these bugs and what I have done to fix them.

First bug - Wrong service definition

I found the first one when adding a command for debugging registered services within the container.

Using the console command:

$ bin/console container:debug


The service definition for “controller.entityform” on "core/" file was wrong. The configured arguments injected are not expected for the class when creating a new instance of the object.

The "" is where all Drupal core services are defined.

Current declaration:

class: Drupal\Core\Entity\HtmlEntityFormController
arguments: ['@class_resolver', '@controller_resolver',
'@service_container', '@entity.manager']

More information about which services are registered on Drupal 8:!

How to reproduce:


The line of code used to reproduce the error is part of the console project. As you can see it is in the project repository.

The get($id) method returns the object associated service form the container. Using the $id parameter as the service identifier. You can see the code on the Symfony Dependency Injection Component repository:

The following error was given:

Recoverable fatal error: Argument 1 passed to Drupal\Core\Entity\HtmlEntityFormController::__construct() must implement interface Drupal\Core\Controller\ControllerResolverInterface, instance of Drupal\Core\DependencyInjection\ClassResolver given in Drupal\Core\Entity\HtmlEntityFormController->__construct() (line 39 of core/lib/Drupal/Core/Entity/HtmlEntityFormController.php).

Proposed Resolution

Inject the proper arguments on the service definition. Based on the API documentation for the class HtmlEntityFormController:

Service declaration should look like this:

class: Drupal\Core\Entity\HtmlEntityFormController
arguments: ['@controller_resolver', '@entity.manager', '@form_builder', NULL]

Even when the final resolution was to remove the service definition for “controller.entityform”. Running the console command helped me find this bug in Drupal 8 core and have it fixed.

More information on the issue page:

  • Name: Remove service definition for controller.entityform from core/
  • Link: - Closed (fixed)

Second Bug - Invalid Composer Version

I found this bug when installing the Console project

$ COMPOSER_BIN_DIR=bin composer require --dev drupal/console:@stable


I was not able to complete the installation because the PHP version required on "composer.json" file was not valid.

Current declaration:

require": {
"php": ">5.4.4-13",

How to Reproduce:

A) Running the installation process of Console project, but not everyone is using the console project, even when Larry Garfield AKA @Crell recommended it on Twitter after seeing my Drupal 8 Console Lightning Talk at DrupalCon Amsterdam.

The D8 console from @jmolivas looks even better than before! Every D8 developer should use it. #DrupalCon

— Larry Garfield (@Crell) October 2, 2014

B) Validate a composer file running the composer validate command. The composer documentation also recommends using this command.

“You should always run the validate command before you commit your composer.json file, and before you tag a release. It will check if your composer.json is valid.”

$ composer validate

After running the validate command, the following error was given:

./composer.json is invalid, the following errors/warnings were found: require.php : invalid version constraint (Could not parse version constraint >5.4.4-13: Invalid version string "5.4.4-13")

Proposed Resolution

Drupal 8 requires PHP 5.4.5 at least, the recommendation was to update the "composer.json" file as follows:

require": {
"php": ">=5.4.5",

This time the patch was accepted and the bug was fixed.

More information on the issue page:

  • Name: Composer require.php : invalid version constraint
  • Link: - Fixed
Technology Tools
Best Practices

Fill out the form to learn how FFW can support your needs.

Read next:

Teaser of "Learn to Make Your Site Accessible" blog

Learn to Make Your Site Accessible in a New Training from FFW

Teaser of Drupal for Customized eCommerce Solutions blog

Using Drupal for Customized eCommerce Solutions

Teaser image of Acquia Engage Awards blog

FFW Clients Named as Finalists in Acquia Engage Awards

FFW Blog - illustration

Introducing Material Design Lite (MDL)