%s() expects exactly 0 arguments, %d given¶
Description¶
The mentionned method does not accept any argument, and reports it.
This is the case of func_num_args(), get_called_class(), error_get_last(), json_last_error_msg(), mysqli_connect_errno(), mysqli_get_links_stats(), mysqli_connect_error(), DOMDocumentFragment::__construct(), XSLTProcessor::hasExsltSupport(), etc. It is also the case for the property hook get()
.
Example¶
<?php
function dump_error(callable $callable) {
try {
var_dump($callable());
} catch (Throwable $e) {
var_dump($e->getMessage());
}
}
?>
Solutions¶
Remove all arguments when calling such method.