Bug #20949
closedSaving translation: strcmp() expects parameter 2 to be string
0%
Description
Warning: strcmp() expects parameter 2 to be string, array given in t3lib/class.t3lib_befunc.php on line 2888
After "save selection" in the submodule "Translation handling".
PHP 5.3 only?
(issue imported from #M11815)
Files
Updated by Steffen Gebert about 15 years ago
Seems really to be PHP 5.3 only. Before str_cmp() didn't bleat about the array.
Updated by Stefan Geith about 15 years ago
I tracked this down a little.
I have set 'german' and clicked on save:
the following variables want to get compared by strcmp:
$settings[selectedLanguages] = "a:1:{i:0;s:2:"de";}"
$CHANGED_SETTINGS[selectedLanguages] = Array(0 => 'de')
for e.g. two languages, these are the variables:
$settings[selectedLanguages] = "a:1:{i:0;s:2:"de";}"
$CHANGED_SETTINGS[selectedLanguages] = Array(0 => 'de', 1=>'en')
Conclusion:
If $CHANGED_SETTINGS[$key] is an array, THEN the serialized array has to be compared with $settings[$key]:
if (is_array($CHANGED_SETTINGS) && isset($CHANGED_SETTINGS[$key])) {
if ( !is_array($CHANGED_SETTINGS[$key]) && strcmp($settings[$key], $CHANGED_SETTINGS[$key]) ) {
$settings[$key] = $CHANGED_SETTINGS[$key];
$changed = 1;
}
if ( is_array($CHANGED_SETTINGS[$key]) && strcmp($settings[$key], serialize($CHANGED_SETTINGS[$key])) ) {
$settings[$key] = serialize($CHANGED_SETTINGS[$key]);
$changed = 1;
}
}
Updated by Stefan Geith about 15 years ago
Corresponding Version of patch (11815-v2.diff) attached.
Updated by Steffen Gebert about 15 years ago
This is a duplicate of #19199. Please set the relationship (and vote ;))
Updated by Francois Suter almost 15 years ago
Committed to 4.3 in revision 6781
Committed to trunk revision 6782