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

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Mon Dec 5 11:12:29 CET 2005


Peter Niederlag schrieb:
> 
> 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').

Not, that will not work in 4.3 either. === is type strict, unlike == 
which does.

'true' == true => true
'true' === true => false

Note:

'false' == true => true !!

Any string that is not empty ("") or consists of a single zero ("0") 
evaluates to true.

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

Change to

if ($level == 'true') {
   $this->level = $this->get_complevel();
} else {
   $this->level = intval($level);
}

Masi

PS: I suggest using compression in the Webserver.




More information about the TYPO3-dev mailing list