|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2014-07-07 06:30 UTC] stas@php.net
[2014-07-07 06:41 UTC] stas@php.net
-Status: Open
+Status: Analyzed
[2015-01-17 13:57 UTC] danack@php.net
[2015-01-19 08:01 UTC] stas@php.net
-Status: Analyzed
+Status: Closed
-Assigned To:
+Assigned To: stas
[2015-01-19 08:01 UTC] stas@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 05:00:01 2025 UTC |
Description: ------------ It seems that a cloned NumberFormatter object loses attributes set to the original object. I tried setting attributes in both NumberFormatter::setTextAttribute() and NumberFormatter::setAttribute() and they were not transferred to the cloned object. It may affect other intl object that has custom attributes. Test script: --------------- $fmt = NumberFormatter::create('en', NumberFormatter::DURATION); $fmt->setTextAttribute(NumberFormatter::DEFAULT_RULESET, "%with-words"); $fmt_clone = clone $fmt; var_dump($fmt->getTextAttribute(NumberFormatter::DEFAULT_RULESET), $fmt_clone->getTextAttribute(NumberFormatter::DEFAULT_RULESET)); $fmt = NumberFormatter::create('en', NumberFormatter::DECIMAL); $fmt->setAttribute(NumberFormatter::FRACTION_DIGITS, 2); $fmt_clone = clone $fmt; var_dump($fmt->getAttribute(NumberFormatter::FRACTION_DIGITS), $fmt_clone->getTextAttribute(NumberFormatter::FRACTION_DIGITS)); Expected result: ---------------- string(9) "%with-words" string(9) "%with-words" int(2) int(2) Actual result: -------------- string(11) "%with-words" string(9) "%duration" int(2) bool(false)