Recent Topics

Call to undefined function: array_combine()

started by on Jan 31, 2012 – Last touched: Jan 31, 2012

Jan 31, 2012 09:41    

Hallo,
hab' versucht am Wochenende B2evo von einer alten Version (Anf. 2009) auf die aktuelle zu upgraden. Alles gelöscht bis auf den Mediaordner und die alte _basic_config.php. Funktionierte auch gut, B2evo schloß die Installation erfolgreich ab doch dann kam noch eine Meldung:
Fatal error: Call to undefined function: array_combine() in /homepages/13/d11748650/htdocs/mweu/members/inc/locales/_locale.funcs.php on line 663

Vermute, die Adresse ist falsch, der Blog liegt im Verzeichnis "Members" der Domain, weiß aber nicht genau wo ich was ändern soll.

Die Zeilen 662-667 in dem Script sind:

// Create "locale" => "prio" list
$accept_list = array_combine($accept_list[1], $accept_list[2]);
$maxq = count($accept_list)+1;
foreach( $accept_list as $k => $v )
{
if( $v === '' )

Danke für eure Unterstützung...

micha
p.s. scheint wohl etwas kompliziert zu sein, die Fehlermeldung kam ca. 1 sek nach der "Installation erfolgreich" meldung. Vielleicht weiß jemand was da noch passiert und kann mich auf die richtige Spur bringen...

Feb 04, 2012 15:07

Hello Sam2kb,

thx for help,

I did these two changes except _upgrade.funcs.php was in my installation at /inc/_core/model/db/ and I did paste the change in
_misc.funcs.php at the end but before */?>.

Hope that was o.k.

I'm sorry to say but I get the same error-code as before.

My php is v.4.49

Any idea what else I can try?

micha

Feb 04, 2012 17:02

You should definitely not see this error

Fatal error: Call to undefined function: array_combine()

Are you sure the file _misc.funcs.php was edited and saved on the server

Feb 04, 2012 17:38

Hmm,

I've definetly overwritten the file on the server. Maybe I did something wrong with editing. Here is the end of _misc.funcs.php.

PHP

function sanitize_id_list$str$return_array false$quote false )
{
    // Explode and trim
    $array array_map'trim'explode(','$str) );
 
    // Convert to integer and remove all empty values
    $array array_filterarray_map('intval'$array) );
 
    if( !$return_array && $quote )
    {    // Quote each element and return a string
        global $DB;
        return $DB->quote($array);
    }
    return ( $return_array $array implode(','$array) );
}
 
 
/**
 * Create json_encode function if it does not exist ( PHP < 5.2.0 )
 *
 * @return string
 */
if ( !function_exists'json_encode' ) )
{
    function json_encode$a false )
    {
        if( is_null$a ) )
        {
            return 'null';
        }
        if( $a === false )
        {
            return 'false';
        }
        if( $a === true )
        {
            return 'true';
        }
        if( is_scalar$a ) )
        {
            if( is_float$a ) )
            { // Always use "." for floats.
                return floatvalstr_replace",""."strval$a ) ) );
            }
 
            if( is_string$a ) )
            {
                $jsonReplaces arrayarray"\\""/""\n""\t""\r""\b"
 
"\f"'"' ), array'\\\\''\\/''\\n''\\t''\\r''\\b''\\f''\"' ) );
                return '"'.str_replace$jsonReplaces[0], $jsonReplaces
 
[1], $a ).'"';
            }
 
            return $a;
        }
        $isList true;
        for( $i 0reset($a); $i count($a); $i++, next($a) )
        {
            if( key($a) !== $i )
            {
                $isList false;
                break;
            }
        }
        $result array();
        if( $isList )
        {
            foreach( $a as $v )
            {
                $result[] = json_encode($v);
            }
            return '['.join','$result ).']';
        }
        else
        {
            foreach( $a as $k => $v )
            {
                $result[] = json_encode($k).':'.json_encode($v);
            }
            return '{'.join','$result ).'}';
        }
    }
}
/*
 * $Log: _misc.funcs.php,v $
 
if (!function_exists('array_combine')) { 
   function array_combine($arr1, $arr2) { 
      $out = array(); 
      $arr1 = array_values($arr1); 
      $arr2 = array_values($arr2); 
      foreach($arr1 as $key1 => $value1) { 
         $out[(string)$value1] = $arr2[$key1]; 
      } 
      return $out; 
   } 
 */
?>

...an here's a link to the error message:
www.medienwerkstatt.eu/members

Feb 04, 2012 17:45

Ok, you did it wrong :) Notice how the code you added is printed in orange.

remove

Code

/*
* $Log: _misc.funcs.php,v $

and closing

Code

*/

Feb 04, 2012 18:39

Ah :D o.k.

I had to overwrite the last line w/out putting the */ at the end.
I'm sorry but my php knowledge is only rudimentary - to say the least. I do things like this only once a year and have always forgotten most of it before year is over... :-/

Thank you very much Sam2kb you made my weekend! :D


Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.