Skip to content

Language: #[\SensitiveParameter] on function — compile-time fatal missing (Zend/zend_attributes.c) #11638

Closed

Description

@PurHur

Category

language · php-src-strict · attribute target validation at compile time

Problem

#[\SensitiveParameter] is legal only on parameters (and parameter-like targets). Applying it to a function must fail at compile time:

Attribute "SensitiveParameter" cannot target function (allowed targets: parameter)

Zend/php-src rejects this during compilation; this compiler accepts the attribute and runs the function.

Verified 2026-06-25 — Docker Zend PHP 8.2 vs php bin/vm.php.

php-src reference

Repro

test/repro/maintainer_gap_sensitive_parameter_function.php

./script/docker-exec.sh -- bash -lc 'php test/repro/maintainer_gap_sensitive_parameter_function.php; php bin/vm.php test/repro/maintainer_gap_sensitive_parameter_function.php'
Probe Zend VM (bug)
#[SensitiveParameter] function probe($x) compile Fatal error prints ok

Implementation hints (PHP-in-PHP)

Done when

  • Repro fails compile on VM with Zend-shaped fatal (not runtime LogicException)
  • Parameter-targeted attribute still compiles
  • Targeted compile/compliance guard

Related

Activity

  1. added
    enhancementNew feature or request
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 25, 2026
  2. PurHur commented on Jun 25, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-b — batch (issues #11638)

  3. PurHur commented on Jun 25, 2026

    @PurHur
    OwnerAuthor

    Merged via #11640

    Verification (Docker):

    • php bin/vm.php test/repro/maintainer_gap_sensitive_parameter_function.php → compile error exit 255 with Attribute "SensitiveParameter" cannot target function (allowed targets: parameter)
    • php bin/vm.php test/repro/reflection_parameter_is_sensitive.php → exit 0 (parameter target still valid)
    • php vendor/bin/phpunit --filter sensitive_parameter_function_target_fatal → OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions