Jump to content

Recommended Posts

Posted

On older php versions this would have generated just a warning, but now throws a fatal error.

Uncaught Exception ArgumentCountError: "3 arguments are required, 2 given" at ...vendors/minphp/language/src/Language.php line 125 {"exception":"[object] (ArgumentCountError(code: 0): 3 arguments are required, 2 given at ...vendors/minphp/language/src/Language.php:125)"} 

 

I tried a try-catch to suppress it but didn't help. Any ideas?

Posted

I found a temporary workaround, initially I was trying a try-catch like this:

	//            $output = call_user_func_array('sprintf', $args);
              try { $output = call_user_func_array('sprintf', $args); }
              catch(ArgumentCountError $e) { }
	

However it didn't work. But this did:

	//            $output = call_user_func_array('sprintf', $args);
              try { $output = sprintf($args[0], $args[1], $args[2]); }
              catch(ArgumentCountError $e) { }
	

 

EDIT: Ok the following works too, just needed a backslash ?

	//            $output = call_user_func_array('sprintf', $args);
              try { $output = call_user_func_array('sprintf', $args); }
              catch(\ArgumentCountError $e) { }
	

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...