Undefined $file variable in locale.inc
erdemkose - July 7, 2006 - 07:05
| Project: | Drupal |
| Version: | 5.x-dev |
| Component: | locale.module |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Gábor Hojtsy |
| Status: | closed |
Description
File: locale.inc
Function: _locale_import_one_string($value, $mode, $lang = NULL)
<?php
if ($hdr["Plural-Forms"] && $p = _locale_import_parse_plural_forms($hdr["Plural-Forms"], $file->filename)) {
?>$file->filename is not defined and cannot be replaced by something else because filename information is not passed to _locale_import_one_string.
What does this bug cause?
Nothing important.
If there is an error in the plural formula then the error message will not contain file name.

#1
Problem still exists in locale.inc 1.93, so I added the
$fileparameter needed by the function and fixed all calls needing it.Some calls, both in locale.inc and install.inc do not need this parameter, because it only applies when
$op == 'db-store'.#2
patching file includes/locale.inc
Hunk #1 succeeded at 535 (offset -1 lines).
Hunk #2 succeeded at 561 (offset -1 lines).
Hunk #3 succeeded at 635 (offset -1 lines).
Hunk #4 FAILED at 674.
1 out of 4 hunks FAILED -- saving rejects to file includes/locale.inc.rej
#3
Indeed, this is still a bug in current Drupal 6.x-dev as of today, so a fix should be in order for both Drupal 5.x and 6.x. Patch for Drupal 5.x-dev attached, please re-version for Drupal 6.x, once comitted.
#4
+1 for 6.x-dev. It's a blocker for me when developing autolocale.
#5
OK, so since this did not get attention on Drupal 5.x, try to start this with Drupal 6.x-dev, after maybe we can get the fix accepted into Drupal 5.x. Patch against Drupal 6.x attached.
#6
Committed to CVS HEAD. Needs to be committed to Drupal 5.
#7
Committed to 5.
#8