Form #after_build is not working for PHP 7x I'm using #after_build in one of my custom module form like follows

  $form['profile_image'] = array (
    '#type' =&gt; 'managed_file',
     '#after_build' =&gt; array("change_pic"),
  );


and the function is

function change_pic($element, &amp;$form_state, $form) {
  if($form_state['values']['profile_image']['fid'] != 0){
    // my code goes here..
    return $element;
  }
}


It's working fine in PHP 5x version. but throws the following error in PHP 7x version. 


  ArgumentCountError: Too few arguments to function change_pic(), 2 passed
  How can we handle this in PHP 7?


Any inputs would be helpful.
There are only 2 args to an after build method, the element and the form state.

Just remove the extra one and it’ll work:

function change_pic($element, &amp;$form_state)