简体   繁体   中英

php version upgrade cause an error for old program

I just installed xampp, to run some old program (created 2 or more years ago) and I'm getting 3 errors I can't figure out.

  1. Strict Standards: Only variables should be passed by reference in C:\\xampp\\htdocs\\2010\\web\\core\\route\\route.php on line 117
    public function loadClass($address,$ext='') {
        $this->extname = preg_replace('/_/','/',$address,3);
line:117>       $this->classname = end(explode('_',$address)).($e= $ext!='' ? '('.$ext.')' :  '');
        include_once(ROOT_ROUTE.'/'.$this->extname.'.php');
        $this->newclass = new $this->classname;
        return $this->newclass;
    }

the line 117 i can't understand, it is not using passed by reference, why there is a error?

Because end() expects an argument passed by reference, you can't use it with a non-variable such as the direct result of another function call or construct.

Quoting from the argument definition in the manual :

This means you must pass it a real variable and not a function returning an array because only actual variables may be passed by reference.

Change

$this->classname = end(explode('_',$address)).($e= $ext!='' ? '('.$ext.')' :  '');

to

$addressTemp = explode('_',$address);
$this->classname = end($addressTemp) . ($e= $ext!='' ? '('.$ext.')' :  '');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM