Re: Re: Liveuser - adding users problem

From: Date: Thu, 01 Sep 2005 12:09:07 +0000
Subject: Re: Re: Liveuser - adding users problem
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20720@lists.php.net to get a copy of this message
Lukas Smith wrote:
Jeroen Houben wrote:
I changed the if statement from if ($required == 'seq') to if ($required === 'seq') It's really bizar and I don't know why, but if $required is set to TRUE, the IF statement evaluates to TRUE (?). Surely I must be doing something work, or overlooking something. Anyway, enforcing type checking fixes the problem.
good catch .. quite embarassing .. after your report i went looking .. "this can only happen if it would be mistaken for a sequence value" .. still did not see it .. since passwd is a required field it matches the criteria .. == does an automatic cast to boolean .. and 'seq' casts to true ... Wow, my head hurts. Took me a while to figure it out, even after your explanation.
Perhaps it's better to always write IF statement with strict type checking until you find out it does NOT yield the desired result. Instead of starting with no type checking. Jeroen

« previous php.pear.general (#20720) next »