Alicia Sereno
Alicia Sereno

Reputation: 13

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

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

Upvotes: 1

Views: 3525

Answers (3)

Manu R S
Manu R S

Reputation: 970

$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..

Upvotes: 0

xdstack
xdstack

Reputation: 21

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

Upvotes: 0

Manoj Purohit
Manoj Purohit

Reputation: 3453

Try this:

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

By the way, what is $action?

Upvotes: 3

Related Questions