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

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Status: Needs review » Needs work

The last submitted patch, t_not_defined_on_import.patch, failed testing.

MantasK’s picture

one more try. fixed white spaces, maybe thats why patch was not accepted.

MantasK’s picture

Status: Needs work » Needs review
MantasK’s picture

Issue summary: View changes

description change

clemens.tolboom’s picture

Issue summary: View changes
Status: Needs review » Needs work

Do 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 :)

Mile23’s picture

Status: Needs work » Closed (won't fix)

It 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

clemens.tolboom’s picture

@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.