Problem/Motivation

During the installation process via Drush (drush site:install) or the Quick Start Command, the unmet requirements are supposed to be displayed in the terminal as a list via InstallerException.

However, in reality, there is no meaningful message, like:

In install.core.inc line 2293:
  Database settings:
  Array

or

In install.core.inc line 2293:
  Extensions PHP: Disabled
  Array

You can also review a duplicated issue with detailed analysis: #3081572: Unexpected description format when parsing the unmet requirements message string.

Steps to reproduce

Run the default Drupal installation via Drush with unmet requirement, for example MySQL < 5.7.8.

Proposed resolution

The proposed resolution is to use Drupal render service, because turns out the requirements arrays items may contain render elements, as it was described by @alexpott in #8:

- title and value can also be render elements
- There can be html in the description which is not good for CLI output

Remaining tasks

1) Open a merge request or attach a patch considering the suggestions in #8.
2) Add a test (if possible);

References:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

drzraf created an issue. See original summary.

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

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now 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.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now 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.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now 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.

Chi’s picture

I came across this issue while testing the new command line tool to install and run Drupal.
https://www.drupal.org/node/2969396

System module is using inline Twig templates for rendering descriptions to avoid double escaping. I think an alternative solution could be using Formatable markup as it implements __toString() magic method.

Chi’s picture

Status: Active » Needs review
dsouza_rohan’s picture

Status: Needs review » Reviewed & tested by the community

Yes, this patch is working for me.

alexpott’s picture

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

Nice find!

      $failures = [];
      foreach ($requirements as $requirement) {
        // Skip warnings altogether for non-interactive installations; these
        // proceed in a single request so there is no good opportunity (and no
        // good method) to warn the user anyway.
        if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {
          $failures[] = $requirement['title'] . ': ' . $requirement['value'] . "\n\n" . $requirement['description'];
        }
      }
      if (!empty($failures)) {
        throw new InstallerException(implode("\n\n", $failures));
      }

I think we should do something like:

      // Throw an exception showing any unmet requirements.
      $failures = [];
      foreach ($requirements as $requirement) {
        // Skip warnings altogether for non-interactive installations; these
        // proceed in a single request so there is no good opportunity (and no
        // good method) to warn the user anyway.
        if (isset($requirement['severity']) && $requirement['severity'] == REQUIREMENT_ERROR) {$failures[] = $requirement['title'] . ': ' . $requirement['value'] . "\n\n" . $requirement['description'];
          $failures[] = \Drupal::service('renderer')->renderPlain([
            '#type' => 'inline_template',
            '#template' => '{{ title }}:{{ value }}<br /><br />{{ description }}',
            '#context' => [
              'title' => $requirement['title'],
              'value' => $requirement['value'],
              'description' => $requirement['description'],
            ],
          ]);
        }
      }
      if (!empty($failures)) {
        throw new InstallerException(\Drupal\Component\Render\PlainTextOutput::renderFromHtml(implode("<br /><br />", $failures)));
      }
  • title and value can also be render elements
  • There can be html in the description which is not good for CLI output

We also should test this somehow.

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

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now 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.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

sami-an’s picture

In install.core.inc line 2289:

PHP extensions: Disabled

Array
-------------------------------------------
https://www.drupal.org/docs/official_docs/en/_evaluator_guide.html

https://www.drupal.org/docs/8/system-requirements/php-requirements

dstrube’s picture

This is still happening in drupal-8.7.2

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

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). 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.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now 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.

loopy1492’s picture

Thank you so much for this patch. Although I'm currently running Drupal 8.9.2, it was still useful. I was just getting an error that said

...
[info] Array to string conversion install.core.inc:2303 [12.86 sec, 11.3 MB]

In install.core.inc line 2307:
                                                        
  [Drupal\Core\Installer\Exception\InstallerException]  
  File system:                                          
                                                        
  Array                                                 
                                                        

Exception trace:
  at /var/www/docroot/core/includes/install.core.inc:2307
 install_display_requirements() at /var/www/docroot/core/includes/install.core.inc:1088
 install_verify_requirements() at /var/www/docroot/core/includes/install.core.inc:701
...

Which is not helpful in any way whatsoever. I applied the patch and I at least now have something I can troubleshoot.

 [notice] Performed install task: install_load_profile [12.54 sec, 11.23 MB]

In install.core.inc line 2308:
                                                                                                                                     
  [Drupal\Core\Installer\Exception\InstallerException]                                                                               
  File system:                                                                                                                       
                                                                                                                                     
  The directory <em class="placeholder">/mnt/gfs/./tmp</em> does not exist. An automated attempt to create this directory failed, p  
  ossibly due to a permissions problem. To proceed with the installation, either create the directory and modify its permissions ma  
  nually or ensure that the installer has the permissions to create it automatically. For more information, see INSTALL.txt or the   
  <a href="https://www.drupal.org/server-permissions">online handbook</a>.                                                           
                                                                                                                                     

Exception trace:
  at /var/www/docroot/core/includes/install.core.inc:2308
 install_display_requirements() at /var/www/docroot/core/includes/install.core.inc:1088

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Matroskeen’s picture

Title: InstallerException 'Extensions PHP: Disabled' Array() » Unmet installation requirements may contain render elements
Issue summary: View changes
Related issues: +#3081572: Unexpected description format when parsing the unmet requirements message string

I came here after receiving the following message during site installation and having no idea what to do next 😃

In install.core.inc line 2293:          
  Database settings:
  Array

I've updated the issue summary and marked another one as duplicated: #3081572: Unexpected description format when parsing the unmet requirements message string (by the way, the IS is very detailed and IMO deserving a credit here).

We still need a patch here, so I'm leaving the current status.

RoSk0’s picture

FileSize
891 bytes

Wasted many hours today because of this - in our environment access to core/install.php is blocked on webserver level for security reasons.

Attaching the patch I done as a workaround based on #5 - thanks @Chi!

It;s not ideal, but it works.

RoSk0’s picture

Status: Needs work » Needs review
FileSize
1.07 KB
1.07 KB
1.07 KB

Improved version - based on #8.

colan’s picture

In 9.3, the above was giving me:

Error: Cannot pass parameter 1 by reference in /path/to/drupal/core/includes/install.core.inc on line 2299

Here's an updated patch (for 9.3) and interdiff.

longwave’s picture

Status: Needs review » Needs work

Closed #3247337: Quick Start: Missing PHP extensions shown as "Array" as duplicate

#21 has failed coding standard checks and needs a bit of work.

ressa’s picture

Issue summary: View changes

Adding Drupal Quick Start Command in Issue Summary.

ressa’s picture

Status: Needs work » Needs review
FileSize
1.11 KB
611 bytes

Here's an updated patch, which removes the tab with spaces and an interdiff.

The patch works well, and an error message is shown, though with HTML, so this bit from the Issue Summary is still relevant:

- There can be html in the description which is not good for CLI output

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

joachim’s picture

Status: Needs review » Reviewed & tested by the community

Before:

In install.core.inc line 2306:

  Database settings:

  Array

After:

In install.core.inc line 2313:

  Database settings:<br /><br />Resolve all issues below to continue the installation. For help configuring your database server
  , see the <a href="https://www.drupal.org/docs/8/install">installation handbook</a>, or contact your hosting provider.<div cla
  ss="item-list"><ul><li>The database server version <em class="placeholder">3.24.0</em> is less than the minimum required versi
  on <em class="placeholder">3.26</em>.</li></ul></div>

Yes, the HTML tags are still not ideal, but the perfect is the enemy of the good and this bug is an absolute PITA. So IMO let's get this in, and stripping the HTML tags can be figured out as a follow-up.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 24: 2833864-24.patch, failed testing. View results

joachim’s picture

Status: Needs work » Reviewed & tested by the community

Test failure looks weird and random?

alexpott’s picture

This is way better that what is in HEAD - getting the info is preferable. But we can do better. Let's to this is a follow-up though because I think there is a few things to discussed. If we use throw new InstallerException(MailFormatHelper::htmlToText(implode("\n\n", $failures))); then the output goes from:

CLI with HTML in it

to:

CLI with no HTML

Matroskeen’s picture

Before we go ahead and commit a fix, can you have a look at my comment #2833864-18: Unmet installation requirements may contain render elements?
I suggested crediting @zoiosilva for filling #3081572: Unexpected description format when parsing the unmet requirements message string - the report was very comprehensive and contains some suggestions too.

alexpott’s picture

Creditting @zoiosilva as per @Matroskeen

alexpott’s picture

Version: 9.4.x-dev » 9.3.x-dev
Status: Reviewed & tested by the community » Fixed
Issue tags: -Needs tests

Crediting @loopy1492 and @joachim for the manual test evidence - given this one is hard to test and we've not managed to write an automated test.

Committed and pushed 3242f339f1 to 10.0.x and e2e4b11b97 to 9.4.x and 2902531a85 to 9.3.x. Thanks!

  • alexpott committed 3242f33 on 10.0.x
    Issue #2833864 by RoSk0, colan, ressa, Chi, alexpott, joachim, loopy1492...

  • alexpott committed e2e4b11 on 9.4.x
    Issue #2833864 by RoSk0, colan, ressa, Chi, alexpott, joachim, loopy1492...

  • alexpott committed 2902531 on 9.3.x
    Issue #2833864 by RoSk0, colan, ressa, Chi, alexpott, joachim, loopy1492...
alexpott’s picture

Status: Fixed » Closed (fixed)

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