[TYPO3-core] RFC #11815: Saving translation: strcmp() expects parameter 2 to be string (PHP5.3)
Rupert Germann
rupi at gmx.li
Tue Nov 17 19:18:10 CET 2009
reminder
greets
rupert
Rupert Germann schrieb:
> hi Stefan,
>
> thanks for digging through this.
>
> your patch works for me.
> I found it a bit hard to read and so I rewrote it, see attached patch.
> the functionality is exactly the same as in your patch.
>
> +1 by reading and testing v3 with trunk under PHP 5.2 and 5.3
>
> greets
> rupert
>
>
>
> Stefan Geith schrieb:
>> 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
>>
>>
>>
>>
>>
>>
>>
>>
>>
>
More information about the TYPO3-team-core
mailing list