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:
- https://github.com/drush-ops/drush/issues/2158
- #2799957: Starting Drupal installation. This takes a while. Consider using the [ok] --notify global option. exception 'Drupal\Core\Installer\Exception\InstallerException' with [error] message 'PHP extensions: Disabled Array' in /home/insasse/workspace/workstation
- #2177655: Replace theme() with drupal_render() in install.core.inc
- #2625820: install_check_translations() sometimes incorrectly returns NULL instead of array
Comment | File | Size | Author |
---|---|---|---|
#29 | Screenshot 2022-02-23 at 16.49.01.png | 173.3 KB | alexpott |
#29 | Screenshot 2022-02-23 at 16.49.54.png | 144.6 KB | alexpott |
#24 | interdiff-21-24.txt | 611 bytes | ressa |
#24 | 2833864-24.patch | 1.11 KB | ressa |
| |||
#21 | 2833864-21.patch | 1.1 KB | colan |
Comments
Comment #5
Chi CreditAttribution: Chi commentedI 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.
Comment #6
Chi CreditAttribution: Chi commentedComment #7
dsouza_rohan CreditAttribution: dsouza_rohan at TATA Consultancy Services commentedYes, this patch is working for me.
Comment #8
alexpottNice find!
I think we should do something like:
We also should test this somehow.
Comment #11
sami-an CreditAttribution: sami-an as a volunteer commentedIn 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
Comment #12
dstrube CreditAttribution: dstrube commentedThis is still happening in drupal-8.7.2
Comment #15
loopy1492 CreditAttribution: loopy1492 commentedThank 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
Which is not helpful in any way whatsoever. I applied the patch and I at least now have something I can troubleshoot.
Comment #18
MatroskeenI came here after receiving the following message during site installation and having no idea what to do next 😃
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.
Comment #19
RoSk0Wasted 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.
Comment #20
RoSk0Improved version - based on #8.
Comment #21
colanIn 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.
Comment #22
longwaveClosed #3247337: Quick Start: Missing PHP extensions shown as "Array" as duplicate
#21 has failed coding standard checks and needs a bit of work.
Comment #23
ressa CreditAttribution: ressa at Ardea commentedAdding Drupal Quick Start Command in Issue Summary.
Comment #24
ressa CreditAttribution: ressa at Ardea commentedHere'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:
Comment #26
joachim CreditAttribution: joachim as a volunteer commentedBefore:
After:
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.
Comment #28
joachim CreditAttribution: joachim at Factorial GmbH commentedTest failure looks weird and random?
Comment #29
alexpottThis 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:to:
Comment #30
MatroskeenBefore 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.
Comment #32
alexpottCreditting @zoiosilva as per @Matroskeen
Comment #33
alexpottCrediting @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!
Comment #37
alexpottOpened the follow-up #3266441: Consider methods to remove HTML from requirements messages displayed during a non-interactive install