Skip to content

Fix Exception::getTrace() #[SensitiveParameter] args redaction (#21339) - #21340

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-21339-sensitive-trace-args
Jul 20, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-21339-sensitive-trace-args

Conversation

@PurHur

@PurHur PurHur commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

Test plan

Issue repro (VM, PROFILE=8.4):

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && PHP_COMPILER_PROFILE=8.4 php bin/vm.php -r '\''
function f(#[\SensitiveParameter] string $password, string $ok) { throw new Exception("boom"); }
try { f("secret", "visible"); } catch (Throwable $e) {
  $a = $e->getTrace()[0]["args"] ?? [];
  echo "argc=", count($a), "\n";
  echo "a0=", isset($a[0]) && is_object($a[0]) ? get_class($a[0]) : "missing", "\n";
  echo "a1=", isset($a[1]) ? var_export($a[1], true) : "missing", "\n";
}
'\'''

Output after fix:

argc=2
a0=SensitiveParameterValue
a1='visible'

PHPUnit:

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter sensitive_parameter_exception_trace'

OK (2 tests — VM + JIT).

Closes #21339

Made with Cursor

…1339).

Include call arguments in exception trace capture and redact sensitive slots via SensitiveParameterValue, matching Zend/php-src instead of IGNORE_ARGS.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: #[\SensitiveParameter] Exception::getTrace() drops all args — must wrap SensitiveParameterValue (re-#15036/#3351, Zend/zend_exceptions.c)

1 participant