View Issue Details

IDProjectCategoryView StatusLast Update
0000360WackoWikiadministrationpublic2019-09-13 09:45
ReporterElar9000 Assigned Toadministrator  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.3.rc 
Target Version5.0.betaFixed in Version5.0.beta 
Summary0000360: Warning: array_merge() [function.array-merge]: Argument #2 is not an array in \classes\wacko.php on line 343
DescriptionWe got in 1372 at wacko.php:
 
 function LoadLang($lang)
 {
  $wackoLanguage = "";
 
  if (!isset($this->languages[$lang]))
  {
   $resourcefile = "lang/lang.".$lang.".php";
   if (@file_exists($resourcefile)) include($resourcefile);
 
   $this->languages[$lang] = $wackoLanguage;
   $ue = array();
   $ue = @array_flip($wackoLanguage["unicode_entities"]);
   if (!isset($ue)) $ue = array();
 
   $this->unicode_entities = array_merge($this->unicode_entities, $ue);
   unset($this->unicode_entities[0]);
  }
 }
 
and:
 
Warning: array_merge() [function.array-merge]: Argument #2 is not an array in Z:\home\wacko\www\classes\wacko.php on line 343
at http://wacko/admin.php
 
Let's try to analyze this - guess the solution could be somewhere near.
 
 
 function LoadLang($lang)
 {
  $wackoLanguage = "";
 
  if (!isset($this->languages[$lang]))
  {
   $resourcefile = "lang/lang.".$lang.".php"; // here we load file
   if (@file_exists($resourcefile)) include($resourcefile); // check & include
 
    // here we start to initialize vars
   $this->languages[$lang] = $wackoLanguage;
   $ue = array(); // form here on -- $ue is surely Array()
   $ue = @array_flip($wackoLanguage["unicode_entities"]);
   if (!isset($ue)) $ue = array(); // It can't be not declared, as it has been declared in a line before previous so this line is not needed
 
    // next come two lines I would like to discuss
   $this->unicode_entities = array_merge($this->unicode_entities, $ue);
   unset($this->unicode_entities[0]);
  }
 }
 
This line:
   $this->unicode_entities = array_merge($this->unicode_entities, $ue);
merges two arrays $this->unicode_entities and $ue,
$this->unicode_entities -- btw, this one is empty so we maybe can replace merge operation with operation of assignment $this->unicode_entities = $ue;
when I do so the Warning disappears but I think it gives not much progress because the next lnie of code:
   unset($this->unicode_entities[0]);
assumes that we have $this->unicode_entities[0] -- but print_r says we don't have it (so the final operation of the function LoadLang($lang) hints at the fact that we don't have the proper result).
 
Before flip_array $ue contains -- letter => unicode_entity as k=>v -- and surely is array,
after flip_array $ue contains -- unicode_entity => letter as k=>v -- and fails is array test,
 
maybe this is because unicode_entity as key.
 
But the final line unset($this->unicode_entities[0]); wants something else than Array (unicode_entity => letter)?
Steps To ReproduceGo to http://wacko-site.dom/admin.php

Warning: array_merge() [function.array-merge]: Argument #2 is not an array in Z:\home\wacko-site\www\classes\wacko.php on line 343
Additional InformationThe mentioned buggy stuff is used here:
        $t2 = @strtr($t1, $this->unicode_entities);
$this->unicode_entities really needs to be unicode_entity => letter

I don't get what is unset($this->unicode_entities[0]); for in the function LoadLang($lang)?


I think we should try this:

 function LoadLang($lang)
 {
  $wackoLanguage = "";
 
  if (!isset($this->languages[$lang]))
  {
   $resourcefile = "lang/lang.".$lang.".php";
   if (@file_exists($resourcefile)) include($resourcefile);
 
   $this->languages[$lang] = $wackoLanguage;
   $ue = array();
   $ue = @array_flip($wackoLanguage["unicode_entities"]);
 
   $this->unicode_entities = $ue;
  }
 }

The warning disappears. Need more tests to find out if there is yet something wrong.
TagsNo tags attached.

Activities

administrator

2010-05-14 21:03

administrator   ~0000759

FIXED:

$this->unicode_entities = array_merge($this->unicode_entities, (array)$ue);

Issue History

Date Modified Username Field Change
2010-04-10 19:10 Elar9000 New Issue
2010-05-14 21:03 administrator Note Added: 0000759
2010-05-14 21:03 administrator Assigned To => administrator
2010-05-14 21:03 administrator Status new => resolved
2010-05-14 21:03 administrator Resolution open => fixed
2010-05-14 21:03 administrator Fixed in Version => 5.0.beta
2010-05-14 21:03 administrator Target Version => 5.0.beta
2010-05-14 21:03 administrator Summary Warning: array_merge() [function.array-merge]: Argument #2 is not an array in Z:\home\wacko\www\classes\wacko.php on line 343 a => Warning: array_merge() [function.array-merge]: Argument #2 is not an array in \classes\wacko.php on line 343
2011-05-31 21:24 administrator Build => R5.0.beta