Message error: 3 passed and at least 4 expected. I understand that 7.1 creates a fatal error but I don't understand why it is expecting 4 arguments in this case and it says that it passed 3 arguments instead of the two normally accepted with call_user_func_array. The error is indicated on this line:
$ret = call_user_func_array(array($this->loadedPlugins[$this->availableMethods[$method]], $method), $args);
After reading the php documentation about user_func_array I saw that the array should be in the second position, so I tried to inverse them :
call_user_func_array($args, array($this->loadedPlugins[$this->availableMethods[$method]], $method));
In this case the error disappears but the images are not showing. This use to work in php5.6 and php7. Any help is appreciated
public function execute($cmd){
$ret = null ;
$out = array();
if($this->escapeChars) {
$cmd= str_replace ('(','\(',$cmd);
$cmd= str_replace (')','\)',$cmd);
}
exec( $cmd .' 2>&1', $out, $ret);
if($ret != 0)
if($this->debug) trigger_error (new phMagickException ('Error executing "'. $cmd.'" <br>return code: '. $ret .' <br>command output :"'. implode("<br>", $out).'"' ), E_USER_NOTICE );
$this->log[] = array(
'cmd' => $cmd
,'return' => $ret
,'output' => $out
);
return $ret ;
}
public function __call($method, $args){
if(! key_exists($method, $this->availableMethods))
throw new Exception ('Call to undefined method : ' . $method);
array_unshift($args, $this);
$ret = call_user_func_array(array($this->loadedPlugins[$this->availableMethods[$method]], $method), $args);
if($ret === false)
throw new Exception ('Error executing method "' . $method ."'");
return $ret ;
}