Skip to content
PHP News
Search
Implemented PHP 8.6

Display Function Arguments in Errors

Adds an error_include_args INI setting that shows the actual arguments passed to a built-in function in its warnings and errors.

Add a error_include_args INI setting as described

Primary vote · 2/3 majority

24 Yes 2 No 1 abstain 92% approval

This poll has closed.

Default value for error_include_args

· 2/3 majority

  • "0" 18
  • "1" 7
  • Abstain 1

This poll has closed.

If error_include_args defaults to 1, default value in run-tests.php

· 1/2 majority

  • "0" 7
  • "1" 1
  • Abstain 12

This poll has closed.

There were three votes. The main vote, to add the setting, passed 24 to 2, with 1 abstaining, against a two-thirds requirement.

The second vote chose the default and needed a simple majority. "0" won 18 to 7, with 1 abstaining, so the setting is off by default. The third vote, on the default for PHP's own test runner, only mattered if the default had been "1". It went 1 for "1" and 7 for "0", with 12 abstaining.

All three closed on May 15, 2026, and the page says it's implemented in PHP 8.6.

Summary

When a built-in PHP function raises a warning, the message names the function but almost never shows what you passed to it. A log tells you chown() failed, but not which file it failed on. This RFC from Calvin Buckley adds an INI setting, error_include_args, that puts the actual arguments in the message.

Before and after

Take this script:

unlink("/tmp");
chown("/", "calvin");
chmod("/", 0777);

Today you get:

Warning: unlink(/tmp): Operation not permitted in /Users/calvin/src/chmod.php on line 3
Warning: chown(): Operation not permitted in /Users/calvin/src/chmod.php on line 4
Warning: chmod(): Operation not permitted in /Users/calvin/src/chmod.php on line 5

With the setting on:

Warning: unlink('/tmp'): Operation not permitted in /Users/calvin/src/chmod.php on line 3
Warning: chown('/', 'calvin'): Operation not permitted in /Users/calvin/src/chmod.php on line 4
Warning: chmod('/', 511): Operation not permitted in /Users/calvin/src/chmod.php on line 5

How it stays safe

It reuses the code that prints arguments in exception backtraces, so it follows the same rules:

  • zend.exception_string_param_max_len truncates long strings, so logs don't fill up.
  • Parameters marked with #[\SensitiveParameter] are redacted, so passwords passed to functions like password_hash() won't show up.

It only applies to built-in functions. Errors you raise yourself with trigger_error() don't change.

The RFC's own benchmark ran a failing call in a tight loop, and it was slower with the setting on: about 1.8 seconds versus 1.1 for a million errors. The author notes that most code doesn't raise errors that often.

What it means for existing code

Nothing changes unless you turn it on, because the vote kept the default at 0. If you enable it, the error text changes, so tools that parse PHP error logs or code in set_error_handler that reads messages may need updates. Extensions should mark sensitive parameters with the attribute.