Only variables can be passed by reference
- by zaf
I had the bright idea of using a custom error handler which led me down a rabbit hole.
Following code gives (with and without custom error handler): Fatal error: Only variables can be passed by reference
function foo(){
$b=array_pop(array("a","b","c"));
return $b;
}
print_r(foo());
Following code gives (only with a custom error handler): (2048) Only variables should be passed by reference
function foo(){
$a=explode( '/' , 'a/b/c');
$c=array_pop(array_slice($a,-2,1));
return $c;
}
print_r(foo());
The second one worries me since I have a lot of 'compact' code. So, I either ditch the bright idea of using a custom error handler (to improve my logging module) or expand all my code.
Anyone with better ideas? Also, WTF?