Undefined variable $file_name at potx.inc:493

Created on 11 March 2024, 10 months ago

Problem/Motivation

For me, when exporting translation strings from my module, the following warning pops up in the console:

[warning] Undefined variable $file_name potx.inc:493

Steps to reproduce

Export the translation of any module via the drush potx multiple --modules=example command from the module's drupal.org page.

Proposed resolution

The problem appears to be the following:

  • The function_potx_build_files() is called in potx.inc. At this point the variable $file_name is not defined, nor is it provided as a parameter (which could have very well been intended, given that a variable of the same name is used in _potx_process_file() and _potx_parse_php_file()).
  • The program enters the if-condition in line 486. Since we are using POTX_BUILD_MULTIPLE in our command, the first bracket is skipped and the definition in line 493 is applied to $file_name. However, within this definition, the variable $file_name is already used, which isn't possible since we haven't defined it to this point.
  • Essentially, we are trying to define $file_name with $file_name.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Active

Version

1.0

Component

Code

Created by

🇩🇪Germany lrwebks Porta Westfalica

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024