
Problem/Motivation
When Drupal requires you to enable some PHP extensions we get the next error:
Array to string conversion
/var/www/html/d8.loc/core/includes/install.core.inc:2181
/var/www/html/d8.loc/core/includes/install.core.inc:1028
An array is set for the requirements (core/modules/system/system.install in line 242), but string is expected.
E.g. we use 'description' element as string in install.core.inc (line 2181).
Proposed resolution
Render inline_template before set to requirements.
Remaining tasks
None
User interface changes
None
API changes
None
Comment | File | Size | Author |
---|---|---|---|
#2 | 2864980-2-array-to-string-conversion.patch | 647 bytes | alan-ps |
Issue fork drupal-2864980
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 2864980-array-to-string
compare
Comments
Comment #2
alan-ps CreditAttribution: alan-ps commentedThis is a possible solution.
Comment #4
alan-ps CreditAttribution: alan-ps commentedComment #6
alan-ps CreditAttribution: alan-ps commentedComment #10
manuel garcia CreditAttribution: manuel garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedRunning into a very similar situation, though this time the line seems to be on
core/includes/install.core.inc:2257
$failures[] = $requirement['title'] . ': ' . $requirement['value'] . "\n\n" . $requirement['description'];
The
description
is of typeinline_template
.Changing that line to this solves the problem, however I doubt it is the correct solution:
$failures[] = $requirement['title'] . ': ' . $requirement['value'] . "\n\n" . $requirement['description']['#context']['error'] . ' ' . $requirement['description']['#context']['description'];
Comment #11
manuel garcia CreditAttribution: manuel garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedRan into this again, and took me a while to track down again, only to realize that it was this issue again. Regarding my previous comment, I didnt read properly the description, it is the same issue as described.
I have tested the patch and it solves the issue, and is simple enough. Setting to RTBC.
Comment #12
alexpottI think there are other related issues. @Manuel Garcia can you give the full stack trace and steps to reproduce. Plus we need test coverage.
Comment #13
manuel garcia CreditAttribution: manuel garcia as a volunteer and at Appnovation for Pfizer, Inc. commentedRegarding tests, was afraid it was going to be the case - no clue how to even start on that.
Here is the stack trace:
Our test does nothing special when setting up (just adds a few users).
I believe the way to replicate this error would be to remove a few of the php extensions required from your system.
Comment #20
DaFeliX CreditAttribution: DaFeliX as a volunteer commentedHi all,
I also encountered this issue, so I took some time to pick this up.
What I did:
1. Make the code testable - I extracted the logic to a separate class, this allows the code to be tested
2. Wrote tests for the current state
3. Used the patch from alan-ps and wrote a additional assert to make sure that the description is an actual string
Feel free to comment on the fork.
Comment #25
mstrelan CreditAttribution: mstrelan at PreviousNext commentedI believe this is a duplicate of #2833864: Unmet installation requirements may contain render elements which has been fixed.