Skip to content

Language: implicit nullable (int $x = null) E_DEPRECATED still silent on file compile under PROFILE=8.4 (re-#26083, Zend/zend_compile.c) #30738

Description

@PurHur

Category

bug · php-src-strict · PHP 8.4 implicit-nullable deprecation

Problem

PHP 8.4 deprecates implicitly nullable typed parameters (function f(int $x = null) without ?int). CompilerVersion::supportsImplicitNullableParameterDeprecation() is already true under PHP_COMPILER_PROFILE=8.4, but file parseAndCompile emits no E_DEPRECATED — the callable still runs and prints NULL.

Closed as fixed in #26083 / #23720 / #22987 / #21390 / #29274 (wording). Tip e188cdc565 is silent again.

Repro (2026-08-13, tip e188cdc565) Zend 8.4 VM PHP_COMPILER_PROFILE=8.4
function f(int $x = null) { var_export($x); } f(); E_DEPRECATED: f(): Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type ?int should be used instead then NULL NULL only (no Deprecated) ❌

Host Zend 8.2 is silent (correct). PROFILE=8.2 / unset 8.4.0-dev should stay silent; the missing diagnostic is the 8.4 compile-time deprecation.

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php -d error_reporting=E_ALL bin/vm.php -r "function f(int \$x = null) { var_export(\$x); echo PHP_EOL; } f();"'

Done when

  • PROFILE≥8.4 file compile: E_DEPRECATED wording matches Zend (f(): Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type ?int should be used instead)
  • PROFILE=8.2 / unset reference: still silent like Zend 8.2
  • ?int $x = null does not deprecate
  • Compliance .phpt + php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Aug 13, 2026
  2. PurHur commented on Aug 13, 2026

    @PurHur
    OwnerAuthor

    claim: worker-lane-A — starting this run

  3. PurHur commented on Aug 13, 2026

    @PurHur
    OwnerAuthor

    Already green on current master — no PR.

    Verified @ 77fa3acede (after the filing tip e188cdc565). File parseAndCompile already emits Zend-shaped E_DEPRECATED via Compiler::maybeEmitImplicitNullableParamDeprecation() (lib/Compiler.php) when CompilerVersion::supportsImplicitNullableParameterDeprecation() is true. Runtime::compile() sets $compiler->setVmContext() so file compile (VM not yet running) still reports.

    Issue repro (Docker, php-src-strict)

    $ ./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_PROFILE=8.4 php -d error_reporting=E_ALL bin/vm.php -r "function f(int \$x = null) { var_export(\$x); echo PHP_EOL; } f();"'
    PHP Deprecated:  f(): Implicitly marking parameter $x as nullable is deprecated, the explicit nullable type must be used instead in Command line code on line 1
    NULL
    

    Same deprecation on file compile (bin/vm.php, bin/jit.php) and during phpc build (AOT compile then hit an unrelated LLVM verify failure on this snippet).

    Done-when

    Check Result
    PROFILE=8.4 file compile emits f(): Implicitly marking… yes
    Wording vs php-src (Zend/tests/gh11488.phpt / RFC) must be used instead — Zend 8.4 does not say ?int should be used instead (that was a paraphrase in the filing table)
    PROFILE=8.2 / unset profile silent (NULL only)
    ?int $x = null no deprecation
    Compliance .phpt ./script/phpunit.sh --filter ImplicitNullableDeprecatedPrefixVMTest → OK (2 tests)

    php-src-strict; no php-compiler-strict shortcut.

    Pillar 1 (this run)

    ./script/release-readiness.sh --json → user_release_ready: yes; inventory OK 7386/7386; north-star5-fast ok. gen0_provenance: stale remains #28998 (exclusive lane A sidecar refresh). Did not run bootstrap-selfhost-link (would collide with that exclusive rebuild).

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 / JITbugSomething isn't workingimplementation-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