panormitis Posted July 12, 2022 Report Posted July 12, 2022 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? Quote
panormitis Posted July 12, 2022 Author Report Posted July 12, 2022 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) { } Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.