Category
language
Problem
The #[\SensitiveParameter] attribute (PHP 8.2) is not parsed or honored. Zend redacts marked parameters in stack traces, var_dump, and debug_backtrace output.
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php -r "
function f(#[\\SensitiveParameter] string \$secret) { throw new Exception(); }
try { f(\"hunter2\"); } catch (Exception \$e) { echo \$e->getTraceAsString(); }
"'
# Trace still shows hunter2 (or compile error if attribute unsupported)
php-src reference
Zend/zend_attributes.c — SensitiveParameter attribute class registration
Zend/zend_builtin_functions.c — backtrace / var_dump redaction
ext/standard/var.c — debug_zval_dump redaction paths
Repro
<?php
function login(#[\SensitiveParameter] string $password): void {
throw new RuntimeException('fail');
}
try {
login('hunter2');
} catch (Throwable $e) {
echo $e->getTraceAsString();
}
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
php repro.php
Zend PHP: trace shows [Sensitive Parameter] instead of hunter2.
This compiler: attribute ignored or parse error; secret visible in trace.
Scope (this repo)
| Area |
Path |
Notes |
| Parser |
php-cfg / nikic parser |
Preserve SensitiveParameter on Param nodes |
| Compiler |
lib/Compiler.php |
Store flag on Func / arg metadata |
| VM |
lib/VM.php, debug_backtrace lowering |
Redact in trace frames |
| Stdlib |
ext/standard/debug_backtrace paths |
Align with Zend |
| Tests |
test/compliance/cases/language/sensitive_parameter*.phpt |
|
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter sensitive_parameter'
./script/ci-fast.sh --filter sensitive_parameter
Links
Category
languageProblem
The
#[\SensitiveParameter]attribute (PHP 8.2) is not parsed or honored. Zend redacts marked parameters in stack traces,var_dump, anddebug_backtraceoutput.php-src reference
Zend/zend_attributes.c—SensitiveParameterattribute class registrationZend/zend_builtin_functions.c— backtrace / var_dump redactionext/standard/var.c—debug_zval_dumpredaction pathsRepro
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php' php repro.phpZend PHP: trace shows
[Sensitive Parameter]instead ofhunter2.This compiler: attribute ignored or parse error; secret visible in trace.
Scope (this repo)
SensitiveParameteronParamnodeslib/Compiler.phpFunc/ arg metadatalib/VM.php,debug_backtraceloweringext/standard/debug_backtracepathstest/compliance/cases/language/sensitive_parameter*.phptDone when
#[\SensitiveParameter]on parameters compilesException::getTraceAsString()anddebug_backtrace()redact marked argsVerification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter sensitive_parameter' ./script/ci-fast.sh --filter sensitive_parameterLinks