Skip to content

Stdlib: error_reporting() — default startup mask parity (phase 2 of #3220) #4842

Closed

Description

@PurHur

Category

stdlib

Problem

error_reporting() exists (#3220) but the VM initializes E_ALL (32767) and never applies Zend's startup mask E_ALL & ~E_DEPRECATED & ~E_STRICT (22527 on PHP 8.2). Restoring a level captured at startup therefore returns 32767 instead of Zend's 22527.

php-src reference

Repro

<?php
$prev = error_reporting(E_ALL);
echo 'during=', error_reporting(), "\n";
error_reporting($prev);
echo 'after=', error_reporting(), "\n";
docker info >/dev/null
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro.php
php bin/vm.php repro.php'
Engine during= after= (restored)
Zend PHP 8.2 32767 22527
This compiler VM 32767 32767

Also verify fresh VM with no prior error_reporting() call: echo error_reporting(), "\n"; → Zend 22527, VM 32767.

Scope

Layer Files
VM lib/VM/ErrorReporter.php — default mask; ext/standard/VmIni.php
CLI bootstrap src/cli_driver.php — align with Zend when not overridden by -d error_reporting=0
Tests test/compliance/cases/stdlib/error_reporting_default_mask.phpt

Done when

  • Fresh VM default error_reporting() matches Zend on same PHP version family
  • Save/restore cycle in repro prints after=22527 (or version-appropriate mask)
  • @ silence / ini_set('error_reporting', …) still work
  • ./script/ci-fast.sh --filter error_reporting_default green

Related

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jun 3, 2026
  2. PurHur commented on Jun 15, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

  3. added a commit that references this issue on Jun 15, 2026
    3ede3ba
  4. PurHur commented on Jun 15, 2026

    @PurHur
    OwnerAuthor

    Merged via #8671.

    Fix: VM ErrorReporter, VmIni ini_restore defaults, and IniRuntime JIT/AOT globals now use Zend startup mask E_ALL & ~E_DEPRECATED & ~E_STRICT (22527 on PHP 8.2) instead of raw E_ALL (32767).

    Verification:

    • VM repro: during=32767, after=22527, fresh error_reporting() → 22527
    • JIT repro: same restore behavior
    • vendor/bin/phpunit --filter error_reporting → 4/4 VM+JIT OK
    • php bin/compile.php -l test/repro-maintainer/error_reporting_default_mask.php → exit 0
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:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions