Closed (works as designed)
Project:
Feeds
Version:
8.x-3.0-alpha9
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Feb 2021 at 23:08 UTC
Updated:
23 Feb 2021 at 12:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
kwiechmann commentedComment #3
kwiechmann commentedUpdated patch file.
Comment #4
megachrizI don't have seen this error before. Can you post the full backtrace of the error?
I see that the result of
formatPlural()seems to be a PluralTranslatableMarkup instance and the result oft()a TranslatableMarkup instance, according to\Drupal\Core\StringTranslation\StringTranslationTrait. And that\Drupal\Core\StringTranslation\TranslatableMarkup::__construct()doesn't accept instances of TranslatableMarkup. But I don't understand why none of the automated tests in Feeds fail on this.Ideally, we would have an automated test that demonstrates the bug.
Comment #5
megachrizComment #6
kwiechmann commented@MegaChriz Thanks for responding. Here is the stack output from Xdebug:
Comment #7
megachrizInteresting, thanks for posting the backtrace. I see that for that log_stdout a similar issue exists:
#3065639: Message translated twice causes error in Migrate UI.
So it could as well be an issue for that module. Not completely sure though. Maybe Feeds shouldn't pass TranslatableMarkup objects to the logger? In that case, I think the adjustment needs to be done in
\Drupal\feeds\State\logMessages().Comment #8
megachrizHm,
Psr\Log\LoggerInterfacedoes allow the message to be an object, if it implements__toString(). TranslatableMarkup does implement that method via the trait\Drupal\Component\Utility\ToStringTrait.Comment #9
kwiechmann commentedBased on your last comment, it appears that this might be a Drupal Core bug? Figured I would be best to start at the module before moving towards Core.
Here is what I am thinking for an update to docroot/core/lib/Drupal/Core/StringTranslation/TranslatableMarkup.php:
Comment #10
megachrizNo, with the comment in #8 I meant that it is allowed to pass objects to the logger. In #7 I asked the question if only strings may be passed to the logger:
Answer: passing an object to a logger is fine as long as it implements
__toString().So I think the bug is in log_stdout, which passes the log message it receives straight to
t(), without checking if the message is a string. The bug looks like to be already fixed in the dev version of that module, as I no longer could spot a call tot()there.So maybe close this issue as "works as designed", if you agree?
Comment #11
kwiechmann commentedThanks for your assistance. The patch against feeds works and meets my current needs. Not sure when I will be able to return to this issue but will look into patching log_stdout 8.x-1.1 or upgrading to log_stdout 8.x-2.x-dev (which has few sites).
Closing as works as designed.