|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74063 NumberFormatter fails after retrieval from session
Submitted: 2017-02-08 17:28 UTC Modified: 2020-01-30 09:16 UTC
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: mrfellows at gmail dot com Assigned: cmb (profile)
Status: Closed Package: intl (PECL)
PHP Version: 7.0.15 OS: ubuntu 16.04.1
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
19 + 48 = ?
Subscribe to this entry?

 [2017-02-08 17:28 UTC] mrfellows at gmail dot com
A NumberFormatter instance retrieved from the session generates an 

'Found unconstructed NumberFormatter: U_ILLEGAL_ARGUMENT_ERROR'

on calling ::format(). 

The code snippet below can be run from the in-built webserver.  The second time the page is requested (within a session), the above error is reported.

Test script:

    $formatter = $_SESSION["currencyFormatter"];
    echo "loaded formatter from session\n";
} else {
    echo "no formatter on session\n";
    $formatter = new NumberFormatter("en_GB", NumberFormatter::CURRENCY);
    $_SESSION["currencyFormatter"] = $formatter;

var_dump($formatter->format(123, NumberFormatter::CURRENCY));
if(intl_is_failure($formatter->getErrorCode())) {
    echo "\n" . $formatter->getErrorMessage();


Expected result:
First request:

no formatter on session
string '£123.00' (length=8)

Subsequent requests:

loaded formatter from session
string '£123.00' (length=8)

Actual result:
First request:

no formatter on session
string '£123.00' (length=8)

Subsequent requests:

loaded formatter from session
boolean false
Found unconstructed NumberFormatter: U_ILLEGAL_ARGUMENT_ERROR


Add a Patch

Pull Requests

Pull requests:

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-02-09 15:01 UTC] andrew dot nester dot dev at gmail dot com
Thanks for pointing out this issue! Just added PR fixing this.
 [2017-03-27 13:06 UTC] testingteam2 at gmail dot com
I am using Magento 2 so enable Intl module.
When enable extension=php_intl.dll 
Then generate error "Fatal error: Class 'IntlDateFormatter' not found"

Check by command line, then giving warning
"PHP Warning:  PHP Startup: Unable to load dynamic library 'E:\xampp\php\ext\php_
intl.dll' - %1 is not a valid Win32 application.
 in Unknown on line 0 "

So please suggest me how to resolve it.
 [2020-01-26 16:04 UTC]
-Status: Open +Status: Verified
 [2020-01-26 16:04 UTC]
I can confirm this issue; however, it is not related to sessions
in particular, but rather that unserialization of NumberFormatter
instances is not (yet) supported.

Since there is no agreed upon solution how to do this
unserialization, it seems to be sensible to disallow serialization
in the first place for now.
 [2020-01-26 16:06 UTC]
The following pull request has been associated:

Patch Name: Fix #74063: NumberFormatter fails after retrieval from session
On GitHub:
 [2020-01-30 09:13 UTC]
Automatic comment on behalf of
Log: Fix #74063: NumberFormatter fails after retrieval from session
 [2020-01-30 09:13 UTC]
-Status: Verified +Status: Closed
 [2020-01-30 09:15 UTC]
-Assigned To: +Assigned To: cmb
 [2020-01-30 09:16 UTC]
To clarify: this issue has been "fixed" in the master branch by
disallowing serialization and unserialization of NumberFormatter
instances altogether.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Dec 05 10:01:26 2023 UTC