$this->AuthTblCols[$colname] == 0 => false
| From: | Anders Biström | Date: | Wed, 25 Apr 2001 15:00:14 +0000 |
| Subject: | $this->AuthTblCols[$colname] == 0 => false | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-52387@lists.php.net to get a copy of this message | ||
Encountered a bug in the bugreport system:
Warning: Could not execute mail delivery program in local/Web/sites/phpweb/bugs.php on line 412
Operating system: SuSE 6.2 / Linux 2.4.2
PHP version: 4.0.4pl1 PHP Bug Type: Scripting Engine problemBug description: $this->AuthTblCols[$colname] == 0 => false Short: In a class "if ($this->arr[$keyname] != 0);" will allways be false. Long: <? class Auth {
var $AuthTblCols = array('login' => 'login',
'passwd' => 'passwd',
'access_lvl' => 0,
'last_login' => 0);
//.... snip ....
function ColOK($colname, $str) {
print_r("<pre>ColOK:");
var_dump($this->AuthTblCols[$colname]);print_r("</pre>");
/* returns string 'access_lvl' (see under) */
if (!empty($this->AuthTblCols[$colname]) &&
!($this->AuthTblCols[$colname] == 0)/* The Line above will allways evaluate false!!?! at first I had: $this->AuthTblCols[$colname] != 0 But it also evaluates false.*/
) {
print_r("HERE");
return (empty($str)?true:$str);
}
return false;
}
function somefunc() {
// a func inside the class will call ColOK()
if (!$str = $this->ColOK('access_lvl',
"somestring I want returned")) echo "Not
ok";
//.... snip ....
}
$auth = new Auth();
$auth->AuthTblCols = array('login' => 'login',
'passwd' => 'passwd',
'access_lvl' => 'access_lvl',
'last_login' => 'last_login');
if (!$auth->A_func_that_will_run_somefunc()) {
echo "Invalid login/password";
exit;
}
?>
Any ideas?