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

fgm - September 16, 2006 - 20:43
Status:active» needs review

Problem still exists in locale.inc 1.93, so I added the $file parameter 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'.

AttachmentSizeStatusTest resultOperations
locale.inc_7.patch2.06 KBIgnoredNoneNone

#2

drumm - December 26, 2006 - 00:22
Version:x.y.z» 5.x-dev
Status:needs review» needs work

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

Gábor Hojtsy - March 29, 2007 - 16:10
Assigned to:Anonymous» Gábor Hojtsy
Status:needs work» reviewed & tested by the community

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.

AttachmentSizeStatusTest resultOperations
missing-file-object.patch2.19 KBIgnoredNoneNone

#4

meba - April 2, 2007 - 10:57

+1 for 6.x-dev. It's a blocker for me when developing autolocale.

#5

Gábor Hojtsy - April 6, 2007 - 10:39
Version:5.x-dev» 6.x-dev

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.

AttachmentSizeStatusTest resultOperations
localefilefix.patch2.2 KBIgnoredNoneNone

#6

Dries - April 6, 2007 - 14:16
Version:6.x-dev» 5.x-dev

Committed to CVS HEAD. Needs to be committed to Drupal 5.

#7

drumm - April 8, 2007 - 01:08
Status:reviewed & tested by the community» fixed

Committed to 5.

#8

Anonymous - April 22, 2007 - 01:16
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.