4

Possible Duplicate:
Call-time pass-by-reference has been deprecated;

My Kohana site, get this alert in libraries file.

Call-time pass-by-reference has been deprecated

Thats problem line:

call_user_func('Formo_'.$name.'::load', & $this);

How can i solve this?

Community
  • 1
  • 1
Karmacoma
  • 658
  • 1
  • 13
  • 37

2 Answers2

7

Remove the & before $this.

PHP5 doesn't need that added - all objects are passed as object identifiers by default, no need to mimic this with passing by reference as it was required for PHP 4.

hakre
  • 193,403
  • 52
  • 435
  • 836
damianb
  • 1,224
  • 7
  • 16
3

To pass a variable by reference in php5 you need to have & on your function declaration. NOT when you are calling the function.

function call_user_func($param1, &$param2) {
  // $param2 will be a reference
  // as mentioned by damianb though objects are by default references
  // http://php.net/manual/en/language.oop5.references.php

}

when calling this just pass in your params as normal and param2 will be passed by reference.

http://php.net/manual/en/language.references.pass.php

The above link clearely explains the error.

Note: There is no reference sign on a function call - only on function definitions. Function definitions alone are enough to correctly pass the argument by reference. As of PHP 5.3.0, you will get a warning saying that "call-time pass-by-reference" is deprecated when you use & in foo(&$a);.

dm03514
  • 54,664
  • 18
  • 108
  • 145