Reputation: 4369
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.
- 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?
Upvotes: 0
Views: 122
Reputation: 212522
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.')' : '');
Upvotes: 4