[development] Call time pass-by-reference for PHP 5.4

Blake Senftner bsenftner at earthlink.net
Fri Oct 26 16:47:35 UTC 2012

It's my understanding that as long as the reference is a variable or a function, the only difference is the removal of the '&' symbol when calling a function that receives the reference:

logic that remains the same:
function foo( &$some_var ) {  // receives reference
  $some_var = 'some value';

allowed old calling syntax:
$my_var = 'original value';
foo( &$my_var );   // obvious it's being passed as a reference

New syntax:
$my_var = 'original value';
foo( $my_var );   // still a reference, just no special syntax when calling

I've been running Drupal 6 in php 5.4, and only had to make a few adjustments like the above to run the latest D6 version. (I get a number of other warnings from other php changes, but this one seems fixed by the above.)

-Blake Senftner

On Oct 26, 2012, at 8:45 AM, Earnie Boyd wrote:

> What is going to be the best way to handle the removal of call time
> pass-by-reference as noted at
> http://www.php.net/manual/en/migration54.incompatible.php?
> This affects a lot of code.  Based on http://drupal.org/node/1498574
> D8 will not be ready for PHP 5.4 but some WAMP and LAMP are already
> delivering it.  My query here though is more looking at preparing for
> any new modules or converting older modules and getting them ready for
> PHP 5.4.  How do others plan to handle this offensive change?
> -- 
> Earnie
> -- https://sites.google.com/site/earnieboyd

More information about the development mailing list