Re: Open Issue :: inactive...
Lukas Kahwe Smith <[email protected]> Tue, 16 Aug 2005 11:16:27 +0200
| Newsgroups | gmane.comp.php.pear.liveuser |
|---|---|
| Message-ID | <[email protected]> |
Jan Bolmeson wrote:
> I am using DB - the problem seems to be that when is_active is set to 0 in
> the db it is returned as:
>
> array(5) {
> auth_user_id => string(32) 8ca795cab0f1c244cc78fffd3387013d
> handle => string(6) madwax
> passwd => string(32) f3bfc29c228b806b6a03513f5c7c149b
> is_active => string(0)
> lastlogin => int 1124182373
> }
>
> And hence both:
>
> // this->propertyValues['is_active'] = string(0)
> If( this->propertyValues['is_active'] !== false)
>
> // this->propertyValues['is_active'] = int 0
> If( this->propertyValues['is_active'] !== false)
>
> Evaluates to TRUE (incorrectly)
>
> ----------------------------
> Whereas
>
> // this->propertyValues['is_active'] = int 0
> If( this->propertyValues['is_active'] != false)
>
> // this->propertyValues['is_active'] = string(0)
> If( this->propertyValues['is_active'] != false)
i think my solution is even cleaner and it was a bad programming
practice that we had the if the way it was ..
if (!array_key_exists('is_active', $this->propertyValues)
|| $this->propertyValues['is_active']
now it specifically checks for a positive result which seems more in the
spirit of paranoid security.
regards,
Lukas