开发者

Pear Auth package

开发者 https://www.devze.com 2023-03-01 08:08 出处:网络
Reading Larry Ullman\'s PHP 5, I was told to install Pear Auth package and also Pear DB. According to Pear website, the DB package has been deprecated in favor of MDB2. So I installed this latter (M

Reading Larry Ullman's PHP 5, I was told to install Pear Auth package and also Pear DB.

According to Pear website, the DB package has been deprecated in favor of MDB2. So I installed this latter (MDB2) package.

I'm getting this warning when I run my program.

Fatal error: Class 'DB' not found in /Users/michaelmitchell/pear/share/pear/Auth/Container/DB.php on line 150

I'm not sure if I have done something wrong (if so, what?) or if the Auth package is somehow referring to the deprecated DB class, or something else?

The third line below if (!DB::isConnection($this->db) is line 150 of DB.php. Can anyone help?

 function _prepare()
    {
        if (!DB::isConnection($this->db)) {
            $res = $this->_connect($this->options['dsn']);
            if (DB::isError($res) || PEAR::isError($res)) {
                return $res;
            }
        }
        if ($this->options['auto_quote'] && $this->db->dsn['phptype'] != 'sqlite') {
            if (strpos('.', $this->options['table']) === false) {
                $this->options['final_table'] = $this->db->quoteIdentifier($this->options['table']);
            } else {
                $t = explode('.', $this->options['table']);
                for ($i = 0, $count = count($t开发者_运维问答); $i < $count; $i++)
                    $t[$i] = $this->db->quoteIdentifier($t[$i]);
                $this->options['final_table'] = implode('.', $t);
            }
            $this->options['final_usernamecol'] = $this->db->quoteIdentifier($this->options['usernamecol']);
            $this->options['final_passwordcol'] = $this->db->quoteIdentifier($this->options['passwordcol']);
        } else {
            $this->options['final_table'] = $this->options['table'];
            $this->options['final_usernamecol'] = $this->options['usernamecol'];
            $this->options['final_passwordcol'] = $this->options['passwordcol'];
        }
        return true;
    }


Do

pear install --force --alldeps Auth

to automatically reinstall with all required dependencies.

In your script, make sure PEAR is in the configured include_path and can be found by any configured autoloaders and/or include the required packages manually.


Don't force to install DB, it's deprecated! Change that line of code in:

if (!MDB2::isConnection($this->db)
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号