1

The error first appears with the call to JB_do_house_keeping(). This function gets called at every request!

JBPlug_do_callback('jb_init', $A=false);  // **ERROR HERE**

define ('JB_INIT_COMPLETED', true);

================================

Then also with JB_save_session():

JBPLUG_do_callback('house_keeping_critical_section', $A = false); // **ERROR HERE**

Please help! I am stuck here: I am a basic coder trying something new...

lonesomeday
  • 233,373
  • 50
  • 316
  • 318
  • 1
    Can we see the code for `JBPLUG_do_callback()`? I'd guess it's something like `function JBPLUG_do_callback(&$a, $b), where the first argument shouldn't have an `&` as a prefix. –  Nov 07 '13 at 06:34
  • 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:29

1 Answers1

2

There are two ways to pass information to a function in PHP:

Functions define how they want to receive their arguments. If they expect to receive it as a reference, that means that the changes the function makes to the variable will have an effect in the scope where the function was called.

If you provide a value where the function is expecting a reference, the function won't properly do what you expect.

For instance, array_splice expects its first argument to be a reference, so that you can get the modifications made to the array. But imagine if you did this:

array_splice(array('foo', 'bar'), 1);

You've passed in a value, not a reference. The code that called your function can't get the modified array, because array_splice doesn't return it. The correct way is like this:

$array = array('foo', 'bar');
array_splice($array, 1);
echo count($array); // echoes 1

This is because array_splice takes a reference, and so modifies a variable.

In your case, you're doing this:

JBPlug_do_callback('jb_init', $A=false); 

Presumably, JBPlug_do_callback is expecting a reference as its second argument. You are providing a value (= returns a value). It may make no difference to what the function does, but technically it's a breach of PHP's rules. (That's why it's a "strict standards" error: it may well not have a bad effect, but it's technically invalid.)

You can solve this, again, simply by providing what PHP wants: a variable:

$A = false;
JBPlug_do_callback('jb_init', $A); 
lonesomeday
  • 233,373
  • 50
  • 316
  • 318