[Typo3-dev] changed behaviour of type-conversion PHP4->PHP5?

Peter Niederlag niederlag at ikd01.de
Mon Dec 5 10:48:35 CET 2005


Hi,

----------------------------------------------------------------
Problem-description:
Type-conversions of Int,String and Boolean in PHP4 and PHP5
----------------------------------------------------------------
The Parameter
$TYPO3_CONF_VARS['FE']['compressionLevel']
can either be set to (int)[1-9] or (boolean)[true/false]

$TYPO3_CONF_VARS however are all assigned as String by Install-Tool
(Since they are assigend using single quotes).

If am not mistaking a Type-String 'true' in PHP4 was autoconverted to
Type-Boolean so a conditional construct like 'if ($level === true)'
would evaluate to Type-boolean true (and false for Type-String '1').

PHP5 seems to leave the string 'true' as string and therefor the
condition won't evaluate to true anymore. :-<

If I would change the condition to 'if ($level == true)' I guess it
would evaluate (boolean)true for $level='1' as well, which is not intended.

So my question to the gurus, what to do best about it?

* Make PHP5 and TYPO3 type-safe? ;)

* Change to 'if (!is_int($level) && $level == true)'?

* Don't care if "$TYPO3_CONF_VARS['FE']['compressionLevel'] = '1'"
behaves as "$TYPO3_CONF_VARS['FE']['compressionLevel'] = 'true'"?

Maybe somebody can shed some light on this and safe me some time on
examination.
I'd like to get http://bugs.typo3.org/view.php?id=1976 fixed.

Thx and greets,
Peter
-- 
Peter Niederlag
http://www.niekom.de * TYPO3 & EDV Dienstleistungen *
http://www.typo3partner.net * professional services network *




More information about the TYPO3-dev mailing list