Innovate faster and cut risk with PHP experts from Zend Services.
Explore Services
Beginning to advanced PHP classes to learn and earn global certification.
Help me choose >
Explore Training
Submit support requests and browse self-service resources.
Explore Support
PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection
Since PHP7.0 func_get_arg(), func_get_args(), debug_backtrace() and exception backtraces have started reporting the current value of a parameter. When analysing your files, PHPCompatibility might not be able to determine if a parameter has been modified. To avoid missing cases where the value would have changed, all occurrences where a parameter is touched will be reported for manual inspection.
func_get_arg()
func_get_args()
debug_backtrace()
Manually inspect warnings. Fix problematic usages. Use phpcs:ignore for the remaining false positives.
phpcs:ignore
function myFunction($email) { $email = trim($email); saveEmail($email); return func_get_arg(0); }
If the intent was to return the original value of $email that was passed to the function, then you will need to fix the logic:
$email
function myFunction($email) { $newEmail = trim($email); saveEmail($newEmail); return func_get_arg(0); }
What we did here is avoid overriding the value of $email, so that it would still be possible to return the original value, maintaining the intended behavior of the code. We could also take the opportunity to get rid of func_get_arg and return $email directly, as the use of func_get_arg is not necessary in this context.
func_get_arg
function myFunction($name) { log($name); debug_backtrace(); }
There is nothing to fix here, yet it will still be reported as a warning by PHPCompatibility.
The following comment is an annotation allowing you to ignore a line or a specific sniff. Here we are specifying that we want to ignore the sniff by its name:
// phpcs:ignore PHPCompatibility.FunctionUse.ArgumentFunctionsReportCurrentValue.NeedsInspection function myFunction($name) { log($name); debug_backtrace(); }
Increase security and cut risk by simplifying PHP application upgrades and migrations.
Long Term Support buys organizations time to migrate.