-1

1st error is

Strict Standards: Only variables should be passed by reference in /home/.sites/143/site2/dispatch.php on line 196

dispatch.php 's line 196 looks like so

$table_name = array_pop(split('/',$controller));

2nd error is

Strict Standards: Only variables should be passed by reference in /home/.sites/143/site2/lib/referer.php on line 18

referer.php 's line 18 looks like so

$agentInfo = array_pop($db->get('agencies','company_name,enabled',"id='$agent_id'"));

3rd error is

Strict Standards: Only variables should be passed by reference in /home/.sites/143/site2/controllers/step4.php on line 978

step4.php 's line 978 looks like so

$info = array_pop($this->db->get_records_by_sql($sql));
John Conde
  • 217,595
  • 99
  • 455
  • 496
  • 3
    Turn those into two lines of code with the code in `array_pop()` being its own line. – John Conde Dec 13 '13 at 20:03
  • 1
    John, that should be the answer. – Jessica Dec 13 '13 at 20:03
  • http://stackoverflow.com/questions/2354609/strict-standards-only-variables-should-be-passed-by-reference – Cole Dec 13 '13 at 20:06
  • http://stackoverflow.com/questions/9848295/strict-standards-only-variables-should-be-passed-by-reference-error – Cole Dec 13 '13 at 20:06
  • http://stackoverflow.com/questions/18041225/strict-standards-only-variables-should-be-passed-by-reference-in-wordpress-wp-i – Cole Dec 13 '13 at 20:07
  • http://stackoverflow.com/questions/18788744/strict-standards-only-variables-should-be-passed-by-reference-in – Cole Dec 13 '13 at 20:07

4 Answers4

2

In your code, you're passing the return value of the split() function to array_pop(), but array_pop() expects an array to be passed by reference, not a value.

You can verify this by looking at the function description in the documentation for array_pop():

mixed array_pop ( array & $array )

The & sign indicates that the function expects an array passed by reference.

You can resolve this issue by using an array variable to store the output of the function. Also, note that split() is deprecated. Use explode() instead:

$array = explode('/', $controller);
$table_name = array_pop($array);

Change all the similar occurrences.

Amal Murali
  • 75,622
  • 18
  • 128
  • 150
  • Tried that generates the error Parse error: syntax error, unexpected '$table_name' (T_VARIABLE) in /home/.sites/143/site2/dispatch.php on line 134 I have also tried preg_split and that generates different errors as well :[ – CanadianCaveman Dec 13 '13 at 20:08
  • @CanadianCaveman: What error? Did you actually change the code as I suggested? – Amal Murali Dec 13 '13 at 20:09
  • Parse error: syntax error, unexpected '$table_name' (T_VARIABLE) in /home/.sites/143/site2/dispatch.php on line 134 is the error I get. – CanadianCaveman Dec 13 '13 at 20:11
  • @CanadianCaveman: That's pretty self-explanatory. Add a semicolon at the end of the first line. – Amal Murali Dec 13 '13 at 20:11
0

Try changing the first one to

$r=explode('/',$controller);
$table_name = array_pop($r);

and then

$q=$db->get('agencies','company_name,enabled',"id='$agent_id'");
$agentInfo = array_pop($q);

and

$q=$this->db->get_records_by_sql($sql);
$info = array_pop($q);

This is because the function array_pop returns a reference to a variable, the last array member. note this only as strict warning, not an error.

Cole
  • 1,483
  • 1
  • 11
  • 20
0

Optimal is, you shoud stay with project in version 5.2, in future just use 5.4. You find out this errors, but you can find any other errors in future and it is not good way to eleminate all your errors in project.

RePRO
  • 217
  • 1
  • 4
  • 11
0

The error means that the PHP function array_pop() requires a reference to a variable instead of a value. See the little & next to the $array parameter on this page?

http://www.php.net/manual/es/function.array-pop.php

You can fix that by using something like this:

$data = $this->db->get_records_by_sql($sql);
$info = array_pop($data);
César
  • 370
  • 1
  • 9