Call-time pass-by-reference has been deprecated

I’ve just tested my new wordpress plugin and I’ve got this warning:


Warning: Call-time pass-by-reference has been deprecated - argument passed by value

My plugin is based on the wordpress plugin framework. It seems that it contains a little bug.


  Line 467:  $this->_UpdatePluginOptions( &$_REQUEST );
  Line 718:  function _UpdatePluginOptions( &$requestArray )

There’s a “&” too much just before $_REQUEST. Two examples below describe how you get that warning and how to avoid it. You may not get the warning if you still use PHP4.

Bad:


  function ping( $pong ) {}
  $ding = "dong";
  ping( &$ding );

Good:


  function ping( &$pong ) {}
  $ding = "dong";
  ping( $ding );

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>