Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When importing badly formatted po file error occurs:
Fatal error: Function name must be a string in core/lib/Drupal/Component/Gettext/PoStreamReader.php on line 518
Problem is that code
// Initialize common values for error logging.
$log_vars = array(
'%uri' => $this->getURI(),
'%line' => $this->_line_number,
);
$t = get_t();
is inside if(), but error reporting with $t is outside it
I'm attaching po file with which error happens and patch
Comment | File | Size | Author |
---|---|---|---|
#2 | t_not_defined_on_import_1751228_2.patch | 1.5 KB | MantasK |
lt.po | 1.38 KB | MantasK | |
t_not_defined_on_import.patch | 1.24 KB | MantasK | |
Comments
Comment #2
MantasK CreditAttribution: MantasK commentedone more try. fixed white spaces, maybe thats why patch was not accepted.
Comment #3
MantasK CreditAttribution: MantasK commentedComment #3.0
MantasK CreditAttribution: MantasK commenteddescription change
Comment #4
clemens.tolboomDo you have an example of a bad PO file? Can you please check your findings against latest core what happens?
It is only necessary to place
$t = get_t();
outside the if statement. You patch changes to many things. OTOH I guess this is not applicable anymore.Please close the bug when not applicable anymore :)
Comment #5
Mile23It looks like HEAD has moved to
String::format()
instead of$t()
, so this issue is not applicable.Relevant change notices:
https://www.drupal.org/node/1312890
https://www.drupal.org/node/2302363
Comment #6
clemens.tolboom@Mile23 I'm not sure this should be a won't fix. Guess Closed (works as designed) is better.
I still wonder whether we have a 'bad .po file' test.