What consequences does "references in call_user_func_array are deprectated" have on form api? The documentation on call_user_func_array has a note, part of it quoted below


  Before PHP 5.4, referenced variables in param_arr are passed to the function by reference, regardless of whether the function expects the respective parameter to be passed by reference. This form of call-time pass by reference does not emit a deprecation notice, but it is nonetheless deprecated, and has been removed in PHP 5.4.


The function drupal_retrieve_form uses call_user_func_array in building the form, and has this comment shortly before the call:


  We need to pass $form_state by reference in order for forms to modify it,
  since call_user_func_array() requires that referenced variables are passed
  explicitly.


While I haven't hit any serious issues running PHP 5.4, it sounds to me like anything that builds a form and then relies on getting back a modified form_state will break on 5.4. I may not entirely understand what's happening here however.

What are the consequences for Form API of this PHP 5.4 change?
No expert, but here's my punt:


  Before PHP 5.4, referenced variables in param_arr are passed to the function by reference, regardless of whether the function expects the respective parameter to be passed by reference. This form of call-time pass by reference ... has been removed in PHP 5.4


means

function myfunction($a, $b) {
  $a++;
  $b++;
  print "myfunction($a, $b)\n";
}

$apples = 10;
$bananas = 20;

// PHP &lt; 5.4: $b is passed by reference, not honouring the function signature
call_user_func_array('myfunction', array($apples, &amp;$bananas));
print("apples: $apples, bananas: $bananas\n");
// PHP &lt; 5.4: $apples = 10, $bananas = 21
// PHP &gt;= 5.4: $apples = 10, $bananas = 20 


and


  Furthermore, this does not apply to internal functions, for which the function signature is honored. 


presumably means (though it seems a bit unnecessary?):

$angle = 1.5;

// Despite passing by reference, there's no chance of $angle changing as the
// function signature's honored for internal functions.
$res = call_user_func('sin', array(&amp;$angle));


Letharion wrote:


  it sounds to me like anything that builds a form and then relies on getting back a modified form_state will break on 5.4


It seems to me like this should be fine, in this case at least: we're passing
a reference exactly where it's expected by the function signature (I presume this is still the right way to pass by reference where that matches the signature). However if I am right, then any modules with typos in their form hooks like this function MYMODULE_form_alter($form, $form_state, $form_id) will work exactly as expected under PHP &lt; 5.4, but 'suddenly' mess up on 5.4.

@Letharion: in another answer you mention you have 5.4 running: I would've thought something would've exploded by now if it wasn't passing $form_state by reference? But IIUC if the following works as expected in 5.4, then the code you reference should be ok:

function myfunction(&amp;$a) {
  $a++;
  print "myfunction($a)\n";
}

$a = 10;

call_user_func_array('myfunction', array(&amp;$a));
print "a: $a\n";
// We expect a to be 11 the second time for all versions of PHP.


My 2 pennies