[TYPO3-core] RFC #11815: Saving translation: strcmp() expects parameter 2 to be string (PHP5.3)
Rupert Germann
rupi at gmx.li
Wed Nov 4 14:50:29 CET 2009
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
>
>
>
>
>
>
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 11815_v3.diff
Type: text/x-diff
Size: 1485 bytes
Desc: not available
URL: <http://lists.typo3.org/pipermail/typo3-team-core/attachments/20091104/87bd0f74/attachment.diff>
More information about the TYPO3-team-core
mailing list