-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Array to string conversion in TsvFormatter.php on line 35 #3721
Comments
What output do you get with |
I get this error: Possibly not related but note that I also encountered #3722 and https://www.drupal.org/project/drupal/issues/3005958. |
When I run this command, I get no output and no warning. Could you provide steps to reproduce from a fresh install? |
It might be related to the PHP version. The array that is sent to the format manager is a list of all modules and the manager is unsuccessfully trying to format it as a table. I'll document the steps. |
You're using locale:check? I'm also using php 7.2.10. local:check does not use the formatter manager, so I'm a bit perplexed as to why this is going through the tsv formatter. |
Yes, I'm using Here's a backtrace from the point where the array occurs in tsvEscape():
|
writeUsingFormatter should not be called unless this function returns true:
However, In theory, anyway. I'll have to reproduce this locally before I can make any progress. |
Here's the output of
I also wonder why I'm getting |
I could potentially work around the symptom by making tsv detect when it is passed data that cannot be processed as a table. However, it would be good to know where that data is being provided from, since the main command handler for |
The data comes from here in
It is set in the batch so it can be printed at the end of the batch. It is batch API that is causing the prints (I think), not locale.
|
So it turns out to be a Drupal core issue. See https://www.drupal.org/project/drupal/issues/3006084 Thanks for your help @greg-1-anderson! |
Hm, I do wonder, though, why |
Couldn't find anything like that, although I did find |
UpdateDBCommands.php looks at |
Indeed, in batch.inc, the output of the finish callback bubbles all the way up to
Now CommandProcessor::dataCanBeFormatted() returns true when it's an array but in the case of locale it is a nested array.
In
So in CommandProcessor::handleResults() the output of results['files'][] & results['failed_files'][] is written:
These are the context keys in
If there is output, it can be a nested array and it should probably be handled in |
So, the real bug here is that While we could certainly improve the fallback behavior of the output-formatter library, I think that the real solution would be to have |
@greg-1-anderson, I agree. Should we reopen this issue or how do you suggest we proceed? |
There is now a release of output formatters that contains the UnstructuredData and UnstructuredListData types, and it is in use on the The main question in that PR is going to be whether the resulting output is then rational. Is the information present useful and interesting to the user? If not, we might want to consider making batch process return its result to backend invoke without printing the result. |
I think that the best way to solve this is to have |
I named the format 'null': consolidation/output-formatters#71 |
Thanks, #3750 has fixed both issues:
|
@greg-1-anderson seems like #3750 never got merged so this issue remains. |
@greg-1-anderson seems like these are the only changes:
I opened a PR in #3917 |
Describe the bug
drush locale:check
gives this notice:Array to string conversion in TsvFormatter.php on line 35
To Reproduce
drush locale:check
Expected behavior
No notice should appear.
Actual behavior
A notice:
Array to string conversion in TsvFormatter.php on line 35
Workaround
System Configuration
Additional information
At the end of the script this message appears:
Array
The text was updated successfully, but these errors were encountered: