Drupal requires mbstring PHP extension for installing (at least installing via drush) since if you do not have mbstring extension, you will get the following error:

PHP Fatal error:  Call to undefined function Drupal\Core\Cache\mb_check_encoding() in /stuffz/projects/contrib/drupal/core/lib/Drupal/Core/Cache/DatabaseBackend.php on line 435
Drush command terminated abnormally due to an unrecoverable error.                                                                                           [error]
Error: Call to undefined function Drupal\Core\Cache\mb_check_encoding() in /stuffz/projects/contrib/drupal/core/lib/Drupal/Core/Cache/DatabaseBackend.php,
line 435

So I created a little patch to solve this problem

CommentFileSizeAuthor
#2 system-add-mbstring-to-requirements.diff351 byteshron84

Comments

hron84 created an issue. See original summary.

hron84’s picture

Status: Active » Needs review
StatusFileSize
new351 bytes
othermachines’s picture

Adding related Issue #2560123: Cache DatabaseBackend depends on mbstring which resolves the error where it occurs rather than adding mbstring to the requirements.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mile23’s picture

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

gnuget’s picture

Status: Needs review » Needs work

mb_check_encoding is optional, we can not just include it in the requirements.

Check #2560123 for more details.

I think we can use the Symfony mbstring polyfill vendor/symfony/polifill-mbstring/Mbstring to fix this without needing to require mbstring.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

alexpott’s picture

This is odd we already have the Symfony polyfill ... vendor/symfony/polyfill-mbstring/bootstrap.php should be loaded as part of vendor/composer/autoload_files.php on every request.

berdir’s picture

Status: Needs work » Closed (works as designed)

There is a reason this issue hasn't been updated since 2015 (not in the way of someone reporting to see this problem). I'm pretty sure it doesn't happen anymore since we have the polyfill. With #2849669: Fix \Drupal\Component\Utility\Unicode() because of the Symfony mbstring polyfill, this is no longer a bug but instead it is now already ahead of everything else in core :)

"Closed (used to be a bug but now it is a feature)" :)

mile23’s picture

Status: Closed (works as designed) » Postponed (maintainer needs more info)

Well, it's a little interesting...

We don't require mbstring for D8 but we do test with it present in the testbot: https://cgit.drupalcode.org/drupalci_environments/tree/php/7.0-apache/Do...

Which means we don't exercise the polyfill during tests, so we have no coverage for them.

So even though this issue is probably fine being closed, it's impossible to prove that it should be.

We should probably suggest the extensions we test for in core/composer.json. That would also include PECL YAML and the others in the testbot environment builder linked above.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

larowlan’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)
Issue tags: +Bug Smash Initiative

Yeah, twig requires the mbstring polyfill, so I think we're fine here now