Bug #81019 [Opn]: Unable to clone NumberFormatter after failed parse()
| From: | corey dot taylor dot fl at gmail dot com | Date: | Sat, 08 May 2021 03:34:23 +0000 |
| Subject: | Bug #81019 [Opn]: Unable to clone NumberFormatter after failed parse() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-233742@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81019&edit=1
ID: 81019
User updated by: corey dot taylor dot fl at gmail dot com
Reported by: corey dot taylor dot fl at gmail dot com
-Summary: Unable to close NumberFormatter after failed parse()
+Summary: Unable to clone NumberFormatter after failed parse()
Status: Open
Type: Bug
Package: Unknown/Other Function
PHP Version: 8.0.6
Block user comment: N
Private report: N
New Comment:
Fixed title typo.
Previous Comments:
------------------------------------------------------------------------
[2021-05-08 03:31:40] corey dot taylor dot fl at gmail dot com
Description:
------------
After calling
NumberFormatter::parse() with an invalid string, cloning the
NumberFormatter instance throws a Fatal Error:
$format = new NumberFormatter('en_US', NumberFormatter::DECIMAL);
$format->parse('abc');
clone $format;
Fatal error: Uncaught Exception: Failed to clone NumberFormatter object
https://3v4l.org/XGVWZ
This seems to only occur with PHP 8.0+. Since parse() returns false on error, I
wouldn't expect it to invalidate the object.
I was not sure what category this bug report falls under.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81019&edit=1