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
Related
#6234 (closed) · #1492
Category
stdlib| php-src-strictProblem
#6234 closed but regressed:
set_error_handler()accepts an enum case as the$callbackargument instead ofTypeError. Zend validates callable type before registration.php-src reference
ext/standard/basic_functions.c—PHP_FUNCTION(set_error_handler),zend_is_callable/ type checksZend/zend_API.c— callable validationRepro
test/repro-maintainer/set_error_handler_enum_operand.php:TypeError: set_error_handler(): Argument #1 ($callback) must be a valid callback or null, no array or string givenuncaught(handler registered or silently accepted)Scope (this repo)
ext/standard/set_error_handler.phpext/standard/VmErrorHandler.php(if present)test/compliance/cases/stdlib/set_error_handler_enum_callback.phptPHP-in-PHP: callable validation in
ext/standard/lib/VM; no C runtime branch.Done when
TypeErroron VM matching Zendfunction,Closure,[obj,method],null) still workrestore_error_handler()unaffectedRelated
#6234 (closed) · #1492