Skip to content

Language: implicit nullable (int $x = null) E_DEPRECATED only via eval — file parseAndCompile silent (re-#21390, Zend/zend_compile.c) #22987

Closed

Description

@PurHur

Category

Language · php-src-strict · PHP 8.4 · pillar 4

Problem

PHP 8.4 deprecates implicit nullable typed parameters (int $x = null). #21390 / #21397 fixed this for eval()-compiled code (compliance implicit_nullable_parameter_deprecated_profile84.phpt is green), but file-level parseAndCompile / bin/vm.php scripts emit no E_DEPRECATED.

Verified 2026-07-25 (PHP_COMPILER_PROFILE=8.4):

Repro Zend 8.4+ VM file compile VM eval('…')
function f(int $x = null) {} in a .php file E_DEPRECATED (8192) silent E_DEPRECATED (8192)
class method / closure / arrow in same file deprecations silent (eval path covered by #21390)

php-src reference

PHP implementation target

  • lib/Compiler.php (message already present near the implicit-nullable path) — ensure file CFG compile emits the same E_DEPRECATED as the eval/compiler_language_warning path
  • Do not rely on compliance eval() alone

Repro

./script/docker-exec.sh -- bash -lc 'export PHP_COMPILER_PROFILE=8.4
cat > /tmp/impl_file.php <<'"'"'PHP'"'"'
<?php
error_reporting(E_ALL);
set_error_handler(static function (int $errno, string $msg): bool {
    echo sprintf("[%d] %s\n", $errno, $msg);
    return true;
});
function f(int $x = null): void {}
class C { public function m(int $y = null): void {} }
$c = function (int $z = null): int { return 1; };
$a = fn (int $w = null): int => 1;
echo "ok\n";
PHP
php bin/vm.php /tmp/impl_file.php
# expect four [8192] Implicitly marking parameter … lines; today only "ok"'

Done when

  • File-level compile under PROFILE=8.4 emits the same four deprecations as Zend / as the existing eval compliance case
  • Compliance .phpt that loads a file (not only eval)
  • 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 Jul 25, 2026
  2. PurHur commented on Jul 25, 2026

    @PurHur
    OwnerAuthor

    claim: Lane B implementer — starting this run

    Trust gates (pre-claim):

  3. PurHur commented on Jul 25, 2026

    @PurHur
    OwnerAuthor

    Merged via #22991 (33a34825)

    Fix

    File-level parseAndCompile runs before VM::running() is set. Wired Runtime's VMContext into Compiler so implicit-nullable E_DEPRECATED emits for main scripts (same path as eval/#21390).

    Verification

    PHP_COMPILER_PROFILE=8.4 php bin/vm.php -d error_reporting=E_ALL /tmp/impl_file.php
    → four PHP Deprecated lines + ok
    
    ./script/phpunit.sh --filter 'implicit_nullable_parameter'
    → OK (3 tests) including new file-level phpt
    

    Note: guest DEFAULT_STARTUP_REPORTING still masks E_DEPRECATED (unlike Zend 8.4’s default E_ALL); enable via -d / PHPT --INI-- for main-file compile-time notices. Same-file set_error_handler does not catch these (Zend: stderr at compile time before handlers run).

  4. PurHur commented on Jul 27, 2026

    @PurHur
    OwnerAuthor

    Cleanup (2026-07-27): re-open tracked in #23720

    Closed here after partial fix, but file-compile E_DEPRECATED under PROFILE=8.4 is still silent on current master. Active work: #23720 (re-#22987). Do not re-file — claim #23720 instead.

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