- Notifications
You must be signed in to change notification settings - Fork8k
Closed
Description
Description
The following code:
<?phpfinalclass ErrorTypeToStringMap{privateconstERROR_STRINGS = [E_STRICT =>"E_STRICT",];privatefunction__construct(){}publicstaticfunctionget(int$errorType) :string{if(!isset(self::ERROR_STRINGS[$errorType])){thrownew \InvalidArgumentException("Invalid error type$errorType");}returnself::ERROR_STRINGS[$errorType];}}set_error_handler(function(int$severity,string$message,string$file,int$line):bool{thrownew \ErrorException($message,0,$severity,$file,$line);});var_dump(ErrorTypeToStringMap::get(E_ERROR));
Resulted in this output:
Assertion failed: !(((zend_executor_globals *) (((char*) _tsrm_ls_cache)+(executor_globals_offset)))->exception), file C:\pocketmine-php-8.4.12-debug\php-src\Zend\zend_vm_execute.h, line 35382
But I expected this output instead:
Fatal error: Uncaught InvalidArgumentException: Invalid error type 1 in C:\Users\dylan-work\Documents\projects\pocketmine-mp\stable\test4.php:16Stack trace:#0 C:\Users\dylan-work\Documents\projects\pocketmine-mp\stable\test4.php(30): ErrorTypeToStringMap::get(1)#1 {main} thrown in C:\Users\dylan-work\Documents\projects\pocketmine-mp\stable\test4.php on line 16
PHP Version
PHP 8.4.12 (cli) (built: Sep 5 2025 15:31:51) (ZTS Visual C++ 2022 x64 DEBUG)Copyright (c) The PHP GroupZend Engine v4.4.12, Copyright (c) Zend Technologies with Zend OPcache v8.4.12, Copyright (c), by Zend Technologies
Operating System
Windows 11