[TYPO3-core] RFC #11815: Saving translation: strcmp() expects parameter 2 to be string (PHP5.3)
    Stefan Geith 
    typo3dev2008.nospam1 at geithware.de
       
    Thu Sep 24 16:29:51 CEST 2009
    
    
  
Hi all,
Oliver Hader schrieb:
>> Bugtracker references:
>> http://bugs.typo3.org/view.php?id=11815
>
>> Problem:
>> Extension manager -> Translation handling -> Save selection.
>> results in
>> Warning: strcmp() expects parameter 2 to be string, array given in
>> t3lib/class.t3lib_befunc.php on line 2888
>>
>> PHP5.3's strcmp() seems to output a warning, if one parameter is array.
>> This wasn't the case in PHP 5.2.
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;
	}
}
Patch attached.
/Stefan
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: 11815-v2.diff
Url: http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20090924/787e81dd/attachment.txt 
    
    
More information about the TYPO3-team-core
mailing list