Skip to content

Regression: set_error_handler() — enum case callback accepted (re-#6234, basic_functions.c) #8784

Description

@PurHur

Category

stdlib | php-src-strict

Problem

#6234 closed but regressed: set_error_handler() accepts an enum case as the $callback argument instead of TypeError. Zend validates callable type before registration.

php-src reference

Repro

test/repro-maintainer/set_error_handler_enum_operand.php:

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php test/repro-maintainer/set_error_handler_enum_operand.php
php bin/vm.php test/repro-maintainer/set_error_handler_enum_operand.php'
Runtime Result
Zend TypeError: set_error_handler(): Argument #1 ($callback) must be a valid callback or null, no array or string given
VM today uncaught (handler registered or silently accepted)

Scope (this repo)

Path Work
ext/standard/set_error_handler.php Reject enum case operands before callable resolution
ext/standard/VmErrorHandler.php (if present) Shared callable guard
Tests test/compliance/cases/stdlib/set_error_handler_enum_callback.phpt

PHP-in-PHP: callable validation in ext/standard / lib/VM; no C runtime branch.

Done when

  • Repro throws TypeError on VM matching Zend
  • Valid callables (function, Closure, [obj,method], null) still work
  • restore_error_handler() unaffected
  • Targeted compliance filter green

Related

#6234 (closed) · #1492

Activity

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