不推荐使用:在第80行的D:\ xampp \ php \ PEAR \ Config.php中弃用了按引用分配new的返回值

时间:2012-05-03 19:02:28

标签: php xampp php-5.3 deprecated

    <?php
/**
* This class is sort of factory class that is responsible for loading
* classes, it check if this class is not defined then it includes the file
* So developer don't need to worry about including that file
* @author Haafiz
*/
class load{

    public static $app_path= APP_PATH;
    public static $model_path=MODEL_PATH;


    /*
    * @param string $model_name <>Name of class(model) that is required to instantiate/load</p>
    * @param bool $continue_on_error  this decide whether to have fatal error or continue on error loading
    * $return object 
    */
    public static function model($model_name,$conitnue_on_error=0){
        if(!class_exists($model_name)){
            $model_filename= strtolower($model_name).".php";
            try{
                include self::$model_path.$model_filename;
            }
            catch(Exception $e){
                if(!$continue_on_error){
                die($e);
                }
            }
            $model=new $model_name();
            return $model;
        }       
    }
}

?>

在上面的代码中必须面对以下错误。有些人在其他一些帖子中说问题在于使用&,我没有使用它。那么在我的案例中究竟是什么呢?所有人似乎都在正确地做每件事。看到一些其他线程,但没有找到任何解决方案。所以,如果其他人了解任何事情,请。 感谢

1 个答案:

答案 0 :(得分:0)

php/PEAR/Config.php中的第80行确实使用了引用。

   function Config()
    {
        $this->container =& new Config_Container('section', 'root');
    } // end constructor

有关此问题以及有关更新PEAR包的信息,请参阅this question