after Language Switcher Dropdown module 7.x-2.1 checkbox setted on site showed only next line and nothing else: "Fatal error: Call to undefined function array_replace_recursive() in ./sites/all/modules/lang_dropdown/lang_dropdown.module on line 666".
Google search gave an answer like this : https://drupal.org/node/1541594 [... array_replace_recursive is only available for php >= 5.3 and thus does throw error on older servers. Since 5.2 is the minimu requirement for drupal I would suggest replacing this with something else.] ... on my host used PHP 5.2.17
to solve this trouble i simple Append next code (getted from https://drupal.org/node/1541594) to module ./sites/all/modules/lang_dropdown/lang_dropdown.module :
/*
* pre php5.3
*/
if (!function_exists('array_replace_recursive')) {
function array_replace_recursive($array, $array1) {
// handle the arguments, merge one by one
$args = func_get_args();
$array = $args[0];
if (!is_array($array)) {
return $array;
}
for ($i = 1; $i < count($args); $i++) {
if (is_array($args[$i])) {
$array = recurse($array, $args[$i]);
}
}
return $array;
}
function recurse($array, $array1) {
foreach ($array1 as $key => $value) {
// create new key in $array, if it is empty or not an array
if (!isset($array[$key]) || (isset($array[$key]) && !is_array($array[$key]))) {
$array[$key] = array();
}
// overwrite the value in the base array
if (is_array($value)) {
$value = recurse($array[$key], $value);
}
$array[$key] = $value;
}
return $array;
}
}
//END php code
P.S. Please fix this issue on module to all
Comments
Comment #1
manfer CreditAttribution: manfer commentedComment #2
manfer CreditAttribution: manfer commentedComment #3
manfer CreditAttribution: manfer commentedFixed a mistake on previous patch. All has been commited and 7.x-2.3 version should resolve this problem by providing an alternative function to array_replace_recursive when PHP version on server doesn't provide array_replace_recursive function.
Comment #4
igl_czech CreditAttribution: igl_czech commentedTnanks for update ! after update module to ver.7.x-2.4 im enable Only "Language Switcher Dropdown" and "Language Switcher Dropdown Hideout
" - Not enabled => module working better , "Language Switcher Dropdown" Box showing on page , but in version 7.x-2.4 generate some Notice's and Warnings (on my PHP 5.2.17) :
•Notice: Undefined variable: new_values in _lang_dropdown_array_replace_recursive() (line 966 of ./sites/all/modules/lang_dropdown/lang_dropdown.module).
•Warning: Missing argument 3 for _lang_dropdown_array_replace_recursive(), called in ./sites/all/modules/lang_dropdown/lang_dropdown.module on line 975 and defined in _lang_dropdown_array_replace_recursive() (line 963 of ./sites/all/modules/lang_dropdown/lang_dropdown.module).
•Warning: Missing argument 3 for _lang_dropdown_array_replace_recursive(), called in ./sites/all/modules/lang_dropdown/lang_dropdown.module on line 986 and defined in _lang_dropdown_array_replace_recursive() (line 963 of ./sites/all/modules/lang_dropdown/lang_dropdown.module).
IF i enable addition "Language Switcher Dropdown Hideout" - 7.x-2.4 generate much more Notice's and Warnings :
•Notice: Undefined offset: 2 in lang_dropdown_hideout_language_switch_links_alter() (line 159 of ./sites/all/modules/lang_dropdown/lang_dropdown_hideout/lang_dropdown_hideout.module).
•Notice: Undefined variable: new_values in _lang_dropdown_array_replace_recursive() (line 966 of ./sites/all/modules/lang_dropdown/lang_dropdown.module).
•Warning: in_array() [function.in-array]: Wrong datatype for second argument in lang_dropdown_hideout_language_switch_links_alter() (line 159 of ./sites/all/modules/lang_dropdown/lang_dropdown_hideout/lang_dropdown_hideout.module).
•Warning: Missing argument 3 for _lang_dropdown_array_replace_recursive(), called in ./sites/all/modules/lang_dropdown/lang_dropdown.module on line 975 and defined in _lang_dropdown_array_replace_recursive() (line 963 of ./sites/all/modules/lang_dropdown/lang_dropdown.module).
•Warning: Missing argument 3 for _lang_dropdown_array_replace_recursive(), called in ./sites/all/modules/lang_dropdown/lang_dropdown.module on line 986 and defined in _lang_dropdown_array_replace_recursive() (line 963 of ./sites/all/modules/lang_dropdown/lang_dropdown.module).
Comment #5
manfer CreditAttribution: manfer commentedSorry. Just change line 963 of lang_dropdown.module from:
to:
Patch has been attached.
Thanks for the report.
Comment #6
manfer CreditAttribution: manfer commentedNew patch that solves the issue on language switcher dropdown hideout module too.
In lang_dropdown_hideout module we have to change line 159 from:
to:
Comment #7
manfer CreditAttribution: manfer commentedComment #8
manfer CreditAttribution: manfer commentedComment #9
igl_czech CreditAttribution: igl_czech commentedmany thanks! implemented your latest patches on ver.7.x-2.4 and all working fine!
Comment #10
manfer CreditAttribution: manfer commented