1

I'm a bit confused by the error I am getting.

The error is:

Strict Standards: Only variables should be passed by reference in functions.php

The line in reference is:

$action = array_pop($a = explode('?', $action)); // strip parameters
Bo Persson
  • 90,663
  • 31
  • 146
  • 203
Alicia Sereno
  • 13
  • 1
  • 3
  • possible duplicate of [Strict Standards: Only variables should be passed by reference](http://stackoverflow.com/questions/2354609/strict-standards-only-variables-should-be-passed-by-reference) – Lorenz Meyer Jun 21 '14 at 08:22

3 Answers3

3

Try this:

$a= explode('?',$action);
$action = array_pop($a);

By the way, what is $action?

Kuf
  • 17,318
  • 6
  • 67
  • 91
Manoj Purohit
  • 3,413
  • 1
  • 15
  • 17
0

array_pop the only parameter is an array passed by reference. The return value of explode("?", $action) does not have any reference.

You should store the return value to a variable first:

$arr = explode('?',$action);
$action = array_pop($arr);

The following things can be passed by reference:

  • Variables, i.e. foo($a)
  • New statements, i.e. foo(new foobar())
  • References returned from functions

Passing by Reference in PHP Manual

xdstack
  • 21
  • 4
0

$action = array_pop($a = explode('?', $action)); ///Wrong

$action = array_pop($a = (explode('?', $action))); ///Right

Makesure you put explode in brackets like (explode()), that's it..

Community
  • 1
  • 1
Manu R S
  • 872
  • 9
  • 6