[php-src] Issue #8706: mb_internal_encoding() : PHP Fatal error: Uncaught ValueError

From: Date: Sat, 04 Jun 2022 16:37:43 +0000
Subject: [php-src] Issue #8706: mb_internal_encoding() : PHP Fatal error: Uncaught ValueError
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241661@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/8706 Author: Zeuh ### Description The following code: ```php <?php try { $res = mb_internal_encoding('BAD_ENCODING_STRING'); } catch (Exception $e) { echo "KO\n"; } ``` Resulted in this output: - for many version of PHP : https://3v4l.org/vbrUB ``` PHP Fatal error: Uncaught ValueError: mb_internal_encoding(): Argument #1 ($encoding) must be a valid encoding, "BAD_ENCODING_STRING" given in /home/ze/dev/php-standford-like-password-policy/test.php:4 Stack trace: #0 /home/ze/dev/php-standford-like-password-policy/test.php(4): mb_internal_encoding() #1 {main} thrown in /home/ze/dev/php-standford-like-password-policy/test.php on line 4 ``` But I expected this output instead : ``` KO ``` Because ValueError Exception will be catched. Tested on PHP Version : 8.0.19, 8.1.6 on Debian 10 ### PHP Version PHP 8.1.6 ### Operating System _No response_

« previous php.bugs (#241661) next »