Menu

#142 bugs in language.inc.php

V.2.11.2
open
nobody
None
5
2014-06-11
2010-01-19
hzolla
No

Several users have reported the following chain of errors after install (myself included).

Notice: Uninitialized string offset: 0 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 33
Notice: Undefined offset: 2 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 50
Notice: Uninitialized string offset: 0 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 33
Notice: Undefined offset: 2 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 50
Notice: Uninitialized string offset: 0 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 33
Notice: Undefined offset: 2 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 50
Notice: Uninitialized string offset: 0 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 33
Notice: Undefined offset: 2 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 50
Notice: Uninitialized string offset: 0 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 33
Notice: Undefined offset: 2 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 50
Notice: Uninitialized string offset: 0 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 33
Notice: Undefined offset: 2 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 50
Notice: Uninitialized string offset: 0 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 33
Notice: Undefined offset: 2 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 50
Notice: Uninitialized string offset: 0 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 33
Notice: Undefined offset: 2 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 50
Notice: Uninitialized string offset: 0 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 33
Notice: Undefined offset: 2 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 50
Notice: Uninitialized string offset: 0 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 33
Notice: Undefined offset: 2 in C:\wamp\www\cuteflow\language_files\language.inc.php on line 50

There are two bugs in language.inc.php.

I have a fix for both:

Problem 1:

On line 33, this syntax is plain wrong:
if ( ($strLine[0] != "#") && (strlen($strLine) > 0) && (substr($strLine,0,5)!="_jotl"))
php does not let you refer to the first character if a string as $strLine[0] the following line of code works fine:
if ( (substr($strLine,0,1) != "#") && (strlen($strLine) > 0) && (substr($strLine,0,5)!="_jotl"))

Problem 2:
The problem on line 50 creates a problem if $splitConfig[2] is null.

if ($splitConfig[2] == 'encoding')
{
$DEFAULT_CHARSET = trim(substr($strLine, $nPos+1));
}

The following block of code fixes this problem and handles the null case for $splitConfig[2]
if (count($splitConfig)>1)
{
if ($splitConfig[2] == 'encoding')
{
$DEFAULT_CHARSET = trim(substr($strLine, $nPos+1));
}
}

See attached updated file

Discussion

  • hzolla

    hzolla - 2010-01-19

    Updated file which fixes this bug

     
  • Mourad AbuSall

    Mourad AbuSall - 2014-06-11

    Many Thanks hzolla for this solution

     

Log in to post a comment.